运行:
import this
你将看到 Tim Peters写的著名的The Zen of Python。译文我就不放了,网上随便一搜大把。
Python之禅也适用于其它产品设计,你觉得呢?
我认为最富有禅意最有普适性的是第2、3、4、5句。第一句可不可以认为是废话?
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书没有一本提到这个彩蛋的!他们是不是有点无趣?