前记: 在不想工作的时候想静下来深入学习自己的吃饭语言。
python 之禅隐藏在python的this中,如下操作可一窥全貌,结合先行者赖勇浩和元创精彩翻译,再简加工之~
import this
print (this)
The Zen of Python, by Tim Peters
Beautiful is better than ugly.
美逾丑(Python以编写优美的代码为目标)
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.
允阳错 (精准捕获异常,除非显示声明,比如不写express: pass这种)
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.
知不易(尽管这种方案起初并不明显,因为你不是python之父)
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!
道亦道,当图之(命名空间是一种绝妙的主意,我应当多加以利用)
后记:文字之音,穷尽余生,绝响绕梁。