The Zen of Python

python之禪,共勉

import this

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!
美勝醜,顯勝隱,簡勝雜,雜勝亂,平勝陡,疏勝蜜。

可讀性是重要的。

特殊情況不能打破規則。

雖然實用勝過純粹。

錯誤決不能悄無聲息地通過。

除非明確沉默。

面對模棱兩可,拒絕猜測的誘惑。

應該有一個——最好只有一個——顯然是這樣做的。

雖然這種方式起初並不明顯,除非你是荷蘭人。

現在總比沒有強。

雖然現在從來沒有比現在更好。

如果實現很難解釋,那是個壞主意。

如果實現容易解釋,那可能是個好主意。

命名空間是一個偉大的想法-讓我們做更多的!



發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章