Python之美
Python之美
新建一个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之美,每个
个人都有自己不同的理解,但总体上就是Python这门语言被设计的核心理念了。下面放出我比较
喜欢的一个中文翻译,大家自行欣赏吧
Tim Peters 著
美比丑好,明比涩强。
简胜于繁,繁强于难。
平言莫绕,宜疏莫密。
行文如水,易懂为王。
勿提特例,皆循此规。
实虽胜纯,识错必究。
若需留证,亦要言明。
不明其理,追根问底。
必有一法,可解谜题。
汝非龟叔,求之故难。
立足当下,行必有方。
行难言喻,所思欠妥。
行易言表,所思可嘉。
名正易识,善莫大焉!