import this # 安装CPython,在解释器运行这一段见原文
The Zen of Python, by Tim Peters
(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.
尽管实用胜过整洁
A. Errors should never pass silently.
但是错误不应被忽略
B. Unless explicitly silenced.
除非确定忽略它
C. In the face of ambiguity, refuse the temptation to guess.
当存在多种可能时,不要去猜测
D.There should be one-- and preferably only one --obvious way to do it.
应该找一个,最好只有一个,显而易见的解决方法
E. Although that way may not be obvious at first unless you're Dutch.
虽然这不容易,因为你不是 Python 之父(这里的 Dutch 是指 Guido )
F. Now is better than never.
做也许好过不做
G. Although never is often better than right now.
但不假思索就动手还不如不做
H. If the implementation is hard to explain, it's a bad idea.
如果方案难讲解,就是个坏主意
I. If the implementation is easy to explain, it may be a good idea.
如果方案易讲解,就是个好主意
G. Namespaces are one honking great idea -- let's do more of those!
命名空间是一种绝妙的理念,我们应当多加利用