欢迎光临散文网 会员登陆 & 注册

Zen of Python(Python编程 之禅)

2022-09-03 10:51 作者:永远的修伊  | 我要投稿

All the principles are listed  below:

  • 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!

    命名空间很好,应该多加使用

Reference link :

Zen of Python - Wikipedia

python之禅源代码_python之禅 - 百度文库 (baidu.com)

(It seems BiliBili does not support the link outside)




Zen of Python(Python编程 之禅)的评论 (共 条)

分享到微博请遵守国家法律