Python的禅,“提姆彼得斯”说的非常有道理道出了这门编程语言的真谛!

时间:2022-11-06 22:06:48

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的禅,由提姆彼得斯

美丽比丑陋好。

外显胜于内隐。

简单比复杂。

复杂的是比复杂的。

平比嵌套好。

稀疏比致密。

可读性计数。

特殊情况下是不够的,打破规则。

虽然实用性节拍纯度。

错误永远不会通过无声。

除非显式地沉默。

面对模糊,拒绝猜测的诱惑。

应该有一个-最好只有一个-明显的方式去做。

虽然这种方式可能不明显,除非你是荷兰人。

现在比从来没有。

虽然从来没有比现在更好。

如果实施是很难解释的,这是个坏主意。

如果实施容易解释,这可能是一个好主意。

名称空间是一个伟大的想法-让我们做更多的!