Zen of Python

Source: Internet
Author: User

Enter import this in Python and you will see the "Zen of Python" written by Tim Peters

the Zen of Python, by Tim Peters Beautiful isbetter than ugly. Explicit isbetter than implicit. Simple isbetter than complex. Complex isbetter than complicated. Flat isbetter than nested. Sparse isbetter than dense. Readability counts. Special cases aren'T special enough to break the rules.Although practicality beats purity. Errors should neverPasssilently. Unless explicitly silenced. In the face of ambiguity, refuse the temptation to guess. There should be one-- andPreferably only one--obvious-do it. Although that, may notBe obvious at first unless're Dutch.Now isbetter than never. Although never isOften better than *right*Now . If the implementation isHard to explain, it's a bad idea.If the implementation isEasy to explain, it is a good idea. Namespaces is one honking great idea-Let's do more than those!Python's Zen beauty is better than ugliness (Python's goal of writing graceful code) is better than obscure (graceful code should be clear, naming specification, style similar) simplicity is better than complexity (graceful code should be concise, not complicated in-house implementation) Complexity is better than clutter (if complexity is unavoidable, the code can not be difficult to understand, to keep the interface concise) flat better than nesting (graceful code should be flat, not too much nesting) interval than compact (graceful code has the appropriate interval, do not expect a line of code to solve the problem) Readability is important (beautiful code is readable) even in the name of the practicality of the special case, do not violate these rules (these rules are paramount) do not tolerate all errors unless you are sure you need to do this (accurately capturing exceptions, not writingexcept:Passstyle code) when there are many possibilities, do not try to guess but try to find one, preferably the only obvious solution (if not sure, use the exhaustive method) although this is not easy, because you are not the father of Python (here Dutch refers to Guido) do may be better than not to do, but not false thinking It's better not to do it (think before you do it) if you can't describe your plan to someone, it's certainly not a good idea; and vice versa (Program evaluation criteria) namespaces are a wonderful concept that we should use (advocacy and call)

Snake Zong Zi jing

the Zen of Python, snake Zong Zi jing tim petersbeautiful isbetter than ugly. Mei Sheng Ugly Explicit isbetter than implicit. Meanwin Dark Simple isbetter than complex. Jiang Complex isbetter than complicated. Forte Miscellaneous Flat isbetter than nested. Shallow wins deep sparse isbetter than dense. Readability counts. Words Special cases aren'T special enough to break the rules.Although practicality beats purity. Abandon to Qing errors should neverPasssilently. No yin difference unless explicitly silenced. Negative in the face of ambiguity, refuse the temptation to guess. Reject number there should be one-- andPreferably only one--obvious-to-do it. Find out a although that notBe obvious at first unless're Dutch.not yet, yearning now isbetter than never. Min line although never isOften better than *right*Now, if the implementation. isHard to explain, it's a bad idea.bad if the implementation iseasy to explain, it is a good idea. Namespaces is one honking great-Let's do more than those!Every teacher out, more famous

Zen of Python

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.