Python@TW: 會眾| IRC| Planet| 郵件列表| 聯絡我們

Tim Peters 所提出的 PEP 20: [http://www.python.org/dev/peps/pep-0020/ The Zen of Python] 是撰寫 Python 程式的精神指標。別懷疑,也別覺得太玄,每一句都是金玉良言。

這裡列出 The Zen of Python 的原文版以及本站 POT 眾人合力的翻譯版。如果想知道中文翻譯是怎麼作出來的,或是想逐條檢討翻譯,請至 ["The Zen Of Python CHT History"] 頁面。

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!

Python 之道 (POT 眾譯版)

美優於醜,顯明好過隱晦。

簡潔者為上,複雜者次之,繁澀者為下。

平舖善於層疊,勻散勝過稠密:應使村婦可讀。

特例難免但不可打破原則,務求純淨卻不可不切實際。

斷勿使錯誤靜靜流逝,除非有意如此。

在模擬兩可之間,拒絕猜測的誘惑。

總會有一種明確的寫法,最好也只有一種,

但或須細想方可得。

現在開始,強過不作,然而不處理常比*馬上*處理更好。

不易解釋的實作方式,就不是好主意。

容易解釋的實作方法,說不定是好主意。

命名空間是個頂呱呱的點子 -- 這種點子愈多愈好!