Python的禅
翻译自https://peps.python.org/pep-0020 优美胜于丑陋 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.)(注:此处 “荷兰人” 暗指 Python 创始人吉多・范罗苏姆(Guido van Rossum),他是荷兰人,强调其设计理念的权威性) 现在做胜于永远不做(Now is better than never.) 尽管 “永远不做” 往往胜于 “现在就做(却做错)”(Although never is often better than right now.)(注: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!)(注:“honking great” 为口语化表达,意为 “非常棒、极其出色”,体现对命名空间设计的认可)