今天在還 "Python 程式超入門 (旗標, 鎌田正浩, 2016)" 這本書之前隨手翻閱前面章節, 發現原來用 import this 這指令會顯示 Tim Peters 寫的 "The Zen of Python (Python 之禪" :
>>> import this
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! (命名空間是個絕佳機制, 要充分利用)
以上中文翻譯參考下面這兩篇修改 :
其中比較令人困惑的是 complex 與 complicated 的差別, 通常它們都被翻譯為中文的 "複雜", 上面兩篇翻譯把 "複雜" 給了 complex, 而把 complicated 翻成 "繁複", 但這樣問題就更複雜了, 因為這兩個英文字意思其實有差別 :
- complex (多而雜) :
表示一個系統由很多元件組成, 或一個問題有很多原因造成, 但 complex 並不代表 difficult (困難), 因為它的反義詞是 simple (簡單), 不是 easy (容易), 也就是說, complex 的東西或問題是結構層次 (level) 上不簡單, 但可能不難拆解或理解. - complicated (晦澀難解) :
表示一個系統或問題並非結構上很複雜, 而是要拆解或理解的難度很高, 所以 complicated 的東西或問題並不代表包含很多元件或因素 (也許結構簡單卻不容易解), 因為它的反義詞是 easy (容易) , 不是 simple (簡單). 所以 complicated 的東西或問題, 其元素或原因可能不多, 但要拆解或解決卻很傷腦筋, 需要花很多精力與時間.
參考 :
# What is the difference between “complicated” and “complex”?
# “Complex”和”Complicated”中文都是「複雜」的意思,它們的用法有何不同?
# “Complex”和”Complicated”中文都是「複雜」的意思,它們的用法有何不同?
"Now is better than never. Although never is often better than *right* now." 這兩句有點費思量, 推測其意思應該是動手寫程式前需要想一想解決辦法有無潛在缺陷, 若貪圖快速解決 (quick hacking) 眼前問題可能會得不償失, 補破網還不如不做 (比如去年南山人壽的資訊系統更新案). 參考 :
沒有留言 :
張貼留言