美文网首页
python之禅

python之禅

作者: 飞跑的蛤蟆 | 来源:发表于2020-05-09 12:59 被阅读0次

    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之禅

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