在 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!
翻译成中文后:
Python的禅意,作者:Tim Peters
美丽的比丑陋的好。
明确的比隐含的好。
简单的比复杂的好。
复杂的比凌乱的好。
扁平的比嵌套的好。
稀疏的比密集的好。
可读性很重要。
特殊情况并不特别,不足以打破规则。
尽管实用性胜过纯粹性。
错误不应该无声地通过。
除非明确的沉默。
面对模棱两可的问题,拒绝猜测的诱惑。
应该有一个--最好是只有一个--明显的方法来做。
尽管这个方法一开始可能并不明显,除非你是 Python 之父。
现在做总比不做好。
尽管永远不做往往比现在做要好。
如果实施是难以解释的,那就是一个坏主意。
如果实现很容易解释,它可能是一个好主意。
命名空间是一个伟大的想法 -- 让我们做更多这样的事情吧!
好吧,以上是机翻的,是不是有点看不懂
我在网上找了个翻译的比较好的:
Python 之禅
Tim Peters 著
美比丑好,明比涩强。
简胜于繁,繁强于难。
平言莫绕,宜疏莫密。
行文如水,易懂为王。
勿提特例,皆循此规。
实虽胜纯,识错必究。
若需留证,亦要言明。
不明其理,追根问底。
必有一法,可解谜题。
汝非龟叔,求之故难。
立足当下,行必有方。
行难言喻,所思欠妥。
行易言表,所思可嘉。
名正易识,善莫大焉!
作者:呆鸟的简书
链接:https://www.jianshu.com/p/237712de064e
来源:简书