一.起源
《Python 之禅》由 Python 核心开发人员之一Tim Peters于 1999 年撰写,列出了 19 条陈述 Python设计哲学的格言。5 年后,它已成为开发人员的标准,以至于PEP 20(Python Enhancement Proposal 增强提案)将其纳入官方 Python 包,创造了如上所示的复活节彩蛋。
Pythonic 的核心思想来自 Python 之禅(The Zen of Python),Python编程语言的“圣经”,可以在pycharm的控制台输入 import this 查看即可.
import this
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!