Zen of Python

Python已经25岁

祝Python生日快乐!

happy25

1991年2月20日,荷兰人(Dutch)Guido van Rossum发布了Python的0.9.0版,至今25年。Python简洁优雅高效,应用极其广泛,在科学计算、机器学习、系统管理、网络开发等众多领域愈加光彩夺目。译Python设计哲学分享给大家:

Python设计哲学,作者Tim Peters(The Zen of Python, by Tim Peters)

美观优于丑陋(Beautiful is better than ugly.)
显明胜过隐晦(Explicit is better than implicit.)
复杂优于混乱(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.)
虽然那种方式起初并非显而易见,除非你是Guido(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官方网站打开shell(黄色按钮),命令行里输入import this即可看到。

Guido大叔今年60岁(1956年1月31日),依然在为Python社区贡献力量,写代码,做演讲,宣传Python新特性,乐此不疲。人生苦短,Python当歌!