Python Community concept ————“Zen of Python"
Want to know this guideline , As long as Python Execute commands in the interpreter import this
>>> import this
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.
......
The Zen of Python, by Tim Peters
python zen ,Tim Peters Writing
Beautiful is better than ugly.
Elegance is better than ugliness , In coding , We should try to make the code look as neat and beautiful as possible , Indentation between codes , Let others exclaim when they read the code again “ wow , The code is really beautiful ”, Programmers only work with “ Jas. “ Pull over
Explicit is better than implicit.
Show is better than hide , When writing code, you should directly stamp the key points when writing comments , Easy to quickly understand the code
Simple is better than complex.
Simplicity is better than complexity , Writing code , Try to use clear and understandable algorithms , I have seen some people say that the shortest code to achieve Tetris , Then I guess his code will not be clear and easy to understand
Complex is better than complicated.
Complexity is better than incomprehension , Different situations , Code algorithm optimization may be very complex , But don't choose the obscure , Otherwise, the next time you see your own code, you will think it was written by someone else
Flat is better than nested.
Single is better than nested , Minimize nested applications when writing code , For example, various functions are nested , I want to play hide and seek with you , Next time I want to use it, I can't find it
Sparse is better than dense.
Sparsity is better than compactness , There is often no desire to see lumps of code , At this time, writing code indents have rank , Lines are scattered and coherent , It is easier to understand the program
Readability counts.
Readability is very important
Special cases aren’t special enough to break the rules.
Special circumstances are not enough to break the rules , That is, you can't violate grammar rules
Although practicality beats purity.
Practice is better than theory , If you want to know how to program well , What's the secret , Then practice is the best secret
Errors should never pass silently.
Mistakes should not be silently ignored , Mistakes should be corrected in time
Unless explicitly silenced.
Unless it's an unimportant warning
In the face of ambiguity, refuse the temptation to guess.
Face ambiguity , Resist the temptation to guess .
There should be one-- and preferably only one --obvious way to do it.
There should be one —— It's better to have only one —— Obvious ways to achieve it , That is, the optimal algorithm
Although that way may not be obvious at first unless you’re Dutch.
Unless you're Dutch , Otherwise, this approach may not be obvious at first ( This means Python The father of Guido)
Now is better than never.
It's better to start now than not , So if you want to learn programming but still hesitate , Please move !
Although never is often better than right now.
It's better not to do it than to do it blindly , Key principles of extreme programming [YAGNI yes You Ain’t Gonna Need It( You don't need it )]. That is, do not over design
If the implementation is hard to explain, it’s a bad idea.
If the implementation is difficult to explain , That's not a good idea , At the beginning of problem solving , The method that is easy to explain should be preferred
If the implementation is easy to explain, it may be a good idea.
If the implementation is easy to explain , Then it might be a good idea .
Namespaces are one honking great idea – let’s do more of those!
Namespaces are a great idea —— Let's use namespaces more !( Avoid the situation of variable name duplication caused by multi person development , Set one manually )
Process ended , Exit code 0, Have you learned the secret of good code now ?