python zen_Python的宗旨(Zen of Python)
我們在Python中導入this模塊,會打印出一段字符串:
import this
翻譯對照如下:
The Zen of Python, by Tim Peters
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.
盡管現(xiàn)實經(jīng)常玷污這些純凈
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.
那兒應(yīng)該有一條,也只有一條明確的道路通向彼岸
Although that way may not be obvious at first unless you’re Dutch.
盡管一開始那條路可能不是那樣明顯,除非你是Dutch
Now is better than never.
現(xiàn)在行動好過從不行動
Although never is often better than *right* now.
盡管不行動經(jīng)常比魯莽行動要好
If the implementation is hard to explain, it’s a bad idea.
如果實現(xiàn)難以解釋,那是一個壞主意
If the implementation is easy to explain, it may be a good idea.
如果實現(xiàn)容易解釋,那可能是個好主意
Namespaces are one honking great idea — let’s do more of those!
命名空間是一個偉大的注意--我們應(yīng)該好好利用
翻譯過來,詩的韻味還是下降了。
總結(jié)
以上是生活随笔為你收集整理的python zen_Python的宗旨(Zen of Python)的全部內(nèi)容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: 后端开发 java_Java后端开发三年
- 下一篇: jmstemplate 获取队列id_学