Python 之禅

编程思想,相当重要,人生阅历的增加,也就是思想的成熟过程。

这篇箴言,值得反复看、反复体验,消化在任何语言每天的开发过程中。

软件:创意、需求、设计、实现、运营。 综合考虑,全盘考虑。

Tim Peters 为 Python 写下的箴言

Python 之禅

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!

命名空间,当有所用。