2014年5月22日 星期四

[python]設計哲學

引用自Python Tutorial,關於Python的設計哲學,原文出自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!
Namespaces(命名空間)是一個喧囂的好點子,讓我們做其他更多的好點子

果然是哲學阿,...有發現在討論他的文章不過有點長,改天看吧
ps:let's do more of those!這句看不大懂...

沒有留言:

張貼留言