The Zen of Python
1. Beautiful is better than ugly.
2. Explicit is better than implicit.
3. Simple is better than complex.
4. Complex is better than complicated.
5. Flat is better than nested.
6. Sparse is better than dense.
7. Readability counts.
8. Special cases aren't special enough to break the rules.
9. Although practicality beats purity.
10. Errors should never pass silently.
11. Unless explicitly silenced.
12. In the face of ambiguity, refuse the temptation to guess.
13. There should be one— and preferably only one —obvious way to do it.
14. Although that way may not be obvious at first unless you're Dutch.
15. Now is better than never.
16. Although never is often better than right now.
17. If the implementation is hard to explain, it's a bad idea.
18. If the implementation is easy to explain, it may be a good idea.
19. Namespaces are one honking great idea — let's do more of those!
(a poem by Tim Peters)
· 優美勝於醜陋,
· 明了勝於晦澀。
· 簡潔勝於複雜,
· 複雜勝於淩亂。
· 扁平勝於嵌套,
· 稀疏勝於密繁。
· 可讀性很重要!
· 即便假借特例的實用性之名,也不可違背這些規則。
· 不要放過一切錯誤,除非錯誤本身需要以忽略對待。
· 不確定面前,我們應抵擋妄加猜測的引誘。
· 應該有一種,也但願只有這一種是顯而易見的解決之道。
· 萬事開頭難,除非荷蘭人。
· 做好過不做,而不假思索就動手還不如不做。
· 如果某個實現無法很好闡釋,那麼它肯定是一個糟糕的辦法;
· 如果某個實現很容易說清楚,那麼它可能就是個不錯的方案。
· 命名空間是個絕妙的發明 —— 對此我們應多多益善!
這些都是摘自網上 , 之所以特意發博 , 是因為用了好幾年 python, 確實深深體會到他的優點 . 並對能寫下這段話的 Tim Peters 表示深深敬意 , 大道至簡 , 不光是用 python, 寫任意程式 , 做任何事何嘗不是這樣 .