[Python 箴言] Python 之禅
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! 命名空间,当有所用。