1. 程式人生 > 其它 >The Zen of Python, by Tim Peters(Python之禪 by Tim Peters)

The Zen of Python, by Tim Peters(Python之禪 by Tim Peters)

import this # 安裝CPython,在直譯器執行這一段見原文

The Zen of Python, by Tim Peters
(Python之禪 by Tim Peters)

  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.
    儘管實用勝過整潔
    A. Errors should never pass silently.
    但是錯誤不應被忽略
    B. Unless explicitly silenced.
    除非確定忽略它
    C. In the face of ambiguity, refuse the temptation to guess.
    當存在多種可能時,不要去猜測
    D.There should be one-- and preferably only one --obvious way to do it.
    應該找一個,最好只有一個,顯而易見的解決方法
    E. Although that way may not be obvious at first unless you're Dutch.
    雖然這不容易,因為你不是 Python 之父(這裡的 Dutch 是指 Guido )
    F. Now is better than never.
    做也許好過不做
    G. Although never is often better than right
    now.
    但不假思索就動手還不如不做
    H. If the implementation is hard to explain, it's a bad idea.
    如果方案難講解,就是個壞主意
    I. If the implementation is easy to explain, it may be a good idea.
    如果方案易講解,就是個好主意
    G. Namespaces are one honking great idea -- let's do more of those!
    名稱空間是一種絕妙的理念,我們應當多加利用
這個人雖然不太勤快,但是還是留下了一些什麼......