程序師世界是廣大編程愛好者互助、分享、學習的平台,程序師世界有你更精彩!
首頁
編程語言
C語言|JAVA編程
Python編程
網頁編程
ASP編程|PHP編程
JSP編程
數據庫知識
MYSQL數據庫|SqlServer數據庫
Oracle數據庫|DB2數據庫
您现在的位置: 程式師世界 >> 編程語言 >  >> 更多編程語言 >> Python

[learn Python from simple to profound] Zen of Python

編輯:Python

Python Zen is hidden in Python Eggs in language , yes Tim Peters In order to write more beautiful 、 concise 、 Easy to read 、 Extensible program , And the principles advocated . stay Python Interactive interface input import this, Carriage return operation , This is it. 《The Zen Of Python》.

Python Zen embodies Python The design philosophy of language , The ideas can be applied to any programming . In fact, this is not just the philosophy of programming , It is also a philosophy of life , An excellent programmer should have a deep accumulation of philosophy and humanities .

>> import this

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!

translate :

Beautiful is better than ugly.

Beauty is better than ugliness .

Explicit is better than implicit.

Clarity is better than ambiguity .

Simple is better than complex.

Simplicity is better than complexity .

Complex is better than complicated.

Complexity is better than incomprehension .

Flat is better than nested.

Plain speaking is better than staggered architecture .

Sparse is better than dense.

Scattered is better than dense .

Readability counts.

Readability is necessary .

Special cases aren’t special enough to break the rules. Although
practicality beats purity.

Although in the face of step by step , Practicality is more important , But there are no exceptions to the rules .

Errors should never pass silently. Unless explicitly silenced.

Mistakes should not be let go easily , Unless it's intentional .

In the face of ambiguity, refuse the temptation to guess.

Don't try to test blindly when you are ambiguous .

There should be one-- and preferably only one --obvious way to do it.

There must be an obvious way to solve it , Better be the only one .

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

Although not so obvious at the beginning , Unless you're Dutch .(Python The founder is a Dutchman , Or make fun of complex problems, like reading Dutch )

Now is better than never. Although never is often better than right
now.

Although it is often better to never start than to do it without thinking , But now is still better than never starting .

If the implementation is hard to explain, it’s a bad idea.

How to implement the plan is difficult to explain , Then it won't work .

If the implementation is easy to explain, it may be a good idea.

If the implementation plan is easy to explain , That might be a good idea .

Namespaces are one honking great idea – let’s do more of those!

Namespaces are a great idea , Let's think more about this .


  1. 上一篇文章:
  2. 下一篇文章:
Copyright © 程式師世界 All Rights Reserved