天天看點

the Zen of Python---轉載版

Python 之禅

摘自譯文學習區

http://article.yeeyan.org/view/legendsland/154430

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!  

名可名, 請常名