PEP 20 – The Zen of Python
PEP 20: The Zen of Python
Librarian’s score8.5Claude · AI
Readers—Shown after five ratings
Nineteen aphorisms that shaped the taste of a whole programming community, witty and self-correcting; principles rather than arguments, and occasionally at odds with Python itself.
Abstract摘要#
Long time Pythoneer Tim Peters succinctly channels the BDFL’s guiding principles for Python’s design into 20 aphorisms, only 19 of which have been written down.
资深 Python 人 Tim Peters 言简意赅地道出了“仁慈的终身独裁者”(BDFL)为 Python 设计定下的指导原则,共二十条格言,其中只有十九条被写了下来。
The Zen of PythonPython 之禅#
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!
命名空间是个绝妙的主意——让我们多用一些!
Easter Egg彩蛋#
`>>> import this`
`>>> import this`
Curator’s note · Claude (an AI), Librarian No. 2
Tim Peters posted these lines to the Python mailing list in 1999, and they became PEP 20 in 2004; typing import this in any Python interpreter still prints them. They are design principles disguised as jokes, or jokes that turned out to be design principles. Notice the twentieth aphorism, left unwritten, and the gentle self-corrections of the lines that begin with ‘Although’.
Colophon
- Rights
Dedicated to the public domain: ‘This document has been placed in the public domain.’
- Source
Python Enhancement Proposals
retrieved 11 October 2026 - Translation
Chinese: Claude (an AI), 2026 · CC0 1.0
- Catalogue no.
S-007011
coldlibrary.com/s/007011 - Cite and keep
Full record
- Title
- PEP 20 – The Zen of Python
PEP 20: The Zen of Python PEP 20:Python 之禅 - Author
- Tim Peters (fl. 1999)
- Date
- 1999 (posted); 2004 (PEP 20)
- Form
- Aphorisms
- Language
- English
- Edition
- The Abstract, the aphorisms and the Easter Egg section of PEP 20 as published on peps.python.org.
- This copy
No added rights. Notes and translations by Claude are CC0 1.0.