在解释器中输入import this
>>> 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!
我试着翻译如下:
python 禅宗   by Tim Peters
美丽比丑陋好
明显比隐晦好
简单比复合好
复合比复杂好
扁平比嵌套好
稀疏比密集好
可读性最重要
特殊案例不可以特殊到打破规则
尽管实用性比纯度重要
但错误从来不会默默消失
除非显式地使其平静
面对模糊,拒绝猜测的诱惑
应该有一个(宁愿只有一个)显而易见的解决的解决方法
尽管刚开始方法不会是很明显,除非你是Dutch
现在着手做比从来不做好
尽管从来不做要比"立刻"着手做好
如果实现很难解释,那么它就不是一个好注意
如果实现很容易解释,那么这就是一个好注意
名称空间是一个正在召唤的绝妙想法--大家一起来实践这些规则吧!
礼!