美文网首页
The Zen of Python——Python之禅

The Zen of Python——Python之禅

作者: seekingtao | 来源:发表于2018-01-10 14:41 被阅读0次

    作者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! 命名空间是一个伟大的灵光,让我们多做几次

    相关文章

      网友评论

          本文标题:The Zen of Python——Python之禅

          本文链接:https://www.haomeiwen.com/subject/eljonxtx.html