2009年8月31日星期一

Zen of python--應該是必讀的吧

The Zen of Python
    Beautiful is better than ugly. 漂亮別醜陋強
Explicit is better than implicit. 顯性比隱性的強
Simple is better than complex. 簡單比複雜強
Complex is better than complicated. 組合複雜比結構複雜強
Flat is better than nested. 直接比嵌套強
Sparse is better than dense. 稀疏比稠密強
Readability counts. 可讀性
Special cases aren't special enough to break the rules. 別壞了規矩
Although practicality beats purity. 與簡潔合拍
Errors should never pass silently. 有問題不能不出聲
Unless explicitly silenced. 
In the face of ambiguity, refuse the temptation to guess. 別叫人家猜
There should be one-- and preferably only one --obvious way to do it. 只有一個合適的方法
Although that way may not be obvious at first unless you're Dutch.
Now is better than never. 馬上行動
Although never is often better than *right* now. 
If the implementation is hard to explain, it's a bad idea. 如果實現的沒辦法解釋,它一定是個壞想法
If the implementation is easy to explain, it may be a good idea. 如果實現解釋起來很簡單,它也許是一個好想法
Namespaces are one honking great idea -- let's do more of those! 

ref: http://www.python.org/dev/peps/pep-0020/

没有评论:

发表评论