Python 之禅

作者: 赵者也 | 来源:发表于2018-01-23 13:45 被阅读3次
    1. 优雅才是王道
    Beautiful is better than ugly.
    

    编程是要解决问题的,设计良好、高效而漂亮的解决方案都会让程序员心生敬意。

    1. 明了胜过晦涩
    Explicit is better than implicit.
    
    1. 化繁为简
    Simple is better than complex.
    
    1. 复杂胜过纠结
    Complex is better than complicated.
    
    1. 减少嵌套
    Flat is better than nested.
    
    1. 稀疏优于稠密
    Sparse is better than dense.
    
    1. 选择最简单可读的方案
    Readability counts.
    
    1. 尽管实用优于纯粹,但规则也比特例重要
    Special cases aren't special enough to break the rules.
    Although practicality beats purity.
    
    1. 除非明确地知道原因,否则不要放过任何错误
    Errors should never pass silently.
    Unless explicitly silenced.
    
    1. 面对歧义,拒绝猜测,弄清楚它。
    In the face of ambiguity, refuse the temptation to guess.
    
    1. 显而易见的做法应该有且仅有一个,尽管它刚开始可能不是那么显而易见,毕竟我们不是那个荷兰人(Python 之父)。
    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.
    
    1. 尽管 “决不” 常常优于 “马上”,但是 “现在” 往往优于 “决不”。
    Now is better than never.
    Although never is often better than *right* now.
    
    1. 如果实现很难解释清楚,就说明这不是一个好主意。
    If the implementation is hard to explain, it's a bad idea.
    
    1. 如果实现很容易解释清楚,仅仅说明这可能是一个好主意。
    If the implementation is easy to explain, it may be a good idea.
    
    1. 命名空间是个好东西 —— 放手去用吧!
    Namespaces are one honking great idea -- let's do more of those!
    

    相关文章

      网友评论

        本文标题:Python 之禅

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