The Zen of 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!

The meaning of the 6th line is as follows.
Sparse is better than dense.
— In short, “don't try to stick too much code on one line.”
[X] Although efficiency is key (and much appreciated), 
being too paragraph-y will stress the reader out 
and make it hard to read your code.

The meaning of the 13th line is as follows.
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.

The inventor of Python is a Dutch programmer named Guido van Rossum.
"Although that way may not be obvious at first unless you're Dutch."
is probably a reference to the inventor of Perl, Larry Wall,
who is not Dutch. 
The Perl scripting language is well known for having many different ways
to accomplish a task.

source from here

コメント

このブログの人気の投稿

シェルピンスキーの三角形

global 変数・ローカル変数