Zen of Python, 编程规则的诗与歌曲

本帖于 2021-08-07 14:42:26 时间, 由版主 移花接木 编辑

The Zen of Python is a collection of 19 "guiding principles" for writing computer programs that influence the design of the Python programming language. Software engineer Tim Peters wrote this set of principles and posted it on the Python mailing list in 1999. Peters's list left open a 20th principle "for Guido to fill in", referring to Guido van Rossum, the original author of the Python language. The vacancy for a 20th principle has not been filled.

Peters's Zen of Python was included as entry number 20 in the language's official Python Enhancement Proposals and was released into the public domain. It is also included as an Easter egg in the Python interpreter, where it can be displayed by entering import this.

In May 2020, Barry Warsaw wrote the lyrics to music.

 

Zen of Python by 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.[a]
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.[b]
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!

所有跟帖: 

是啊,计算机语言也是语言,也是歌词!编曲配器听着很酷! -beautifulwind- 给 beautifulwind 发送悄悄话 beautifulwind 的博客首页 (0 bytes) () 08/07/2021 postreply 15:09:55

音乐响起,恍惚间我觉得是枫老师的作品, 这首押韵的编程规则很酷,写了19条还留下一条等人填上去。 -移花接木- 给 移花接木 发送悄悄话 移花接木 的博客首页 (0 bytes) () 08/07/2021 postreply 15:22:41

这歌词写得太棒了! -欲借嵯峨- 给 欲借嵯峨 发送悄悄话 欲借嵯峨 的博客首页 (0 bytes) () 08/07/2021 postreply 15:30:20

My favorite “If the implementation is hard to explain, it's a ba -Lily2005- 给 Lily2005 发送悄悄话 Lily2005 的博客首页 (0 bytes) () 08/07/2021 postreply 18:47:00

这歌酷,确实如此,我一直追求越简单越好,哈哈! -天山晨- 给 天山晨 发送悄悄话 天山晨 的博客首页 (0 bytes) () 08/07/2021 postreply 19:19:46

PYTHON = (P)rogrammers (Y)earning (T)o (H)omestead (O)ur (N)oosp -LYJiang- 给 LYJiang 发送悄悄话 LYJiang 的博客首页 (76 bytes) () 08/07/2021 postreply 20:11:55

IT guy...haha , how about C++? -盈盈一笑间- 给 盈盈一笑间 发送悄悄话 盈盈一笑间 的博客首页 (0 bytes) () 08/08/2021 postreply 10:23:15

I'm 2 old 2 C# -移花接木- 给 移花接木 发送悄悄话 移花接木 的博客首页 (0 bytes) () 08/08/2021 postreply 16:18:16

C# will be 2 easy for you. -Lily2005- 给 Lily2005 发送悄悄话 Lily2005 的博客首页 (0 bytes) () 08/08/2021 postreply 20:21:59

need reading glasses, 老花镜 -移花接木- 给 移花接木 发送悄悄话 移花接木 的博客首页 (0 bytes) () 08/08/2021 postreply 20:27:28

Philosophical :) Great! -甜虫虫- 给 甜虫虫 发送悄悄话 甜虫虫 的博客首页 (0 bytes) () 08/09/2021 postreply 08:35:33

请您先登陆,再发跟帖!