「翻译」Python之禅

原创
2020/05/05 10:26
阅读数 268

python之禅

Python之禅


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!
命名空间大法好,越用越环保!

参考

展开阅读全文
加载中
点击引领话题📣 发布并加入讨论🔥
打赏
0 评论
0 收藏
0
分享
返回顶部
顶部