Skip to content

Instantly share code, notes, and snippets.

@vikbert
Last active May 29, 2018 12:50
Show Gist options
  • Select an option

  • Save vikbert/a23bee7730b831d5fe9ee90bdf6d7b3d to your computer and use it in GitHub Desktop.

Select an option

Save vikbert/a23bee7730b831d5fe9ee90bdf6d7b3d to your computer and use it in GitHub Desktop.
[zen of programming] #programming, #编程准则

Zend of Python

The 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.
要有一个,而且最好是只有一个,最易懂的方法去实现它

Although that way may not be obvious at first unless you're Dutch.

Now is better than never.
现在开始,总比永远不,要好些。

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!
命名空间是好主意,要常常实用它

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment