禪道Python

fango發表於2012-09-13

剛看到這個,覺得好玩,就翻譯了一下:

The Zen of Python, by Tim Peters

  • 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!名空間真他爹的是個好主意--都過來多幹吧!

fango

相關文章