A programmer's good qualities can be seen in his code style.
The official Python Developer's Guide, PEP8, lists style guides for Python Code.
Excerpts from the Python ' s tutorial are listed.
1. Indent with 4 spaces instead of the TAB key.
2. Make each line not more than 79 characters, the purpose is small screen user also can read very well.
3. Use an empty line to separate functions, classes, and functions from the large blocks of code.
4. If possible, write the comments in one line.
5.Use docstrings. Use a document string. (Ps. This can be used well)
6. Use a space on both sides of the operator, as well as a space after the comma, but do not use spaces where the parentheses are connected.
7. Maintain the consistency of the class name and function name; The Convention is that the class name uses the camelcase format, and the method name and function name are in lower_case_with_underscres form. Always use self as the first parameter name of a method.
8. If your code is intended to be used in an international environment, do not use some novel encoding format, Pyhton's default encoding format is UTF-8.
9. Similarly, if the reader or maintainer of the code is basically not using the requirements of another language, then do not use non-ASCII characters in the identifiers.
Ps:camelcase is also called camel writing, divided into two kinds, one is the small camel writing, CamelCase, one is the big camel writing, CamelCase, also known as Pascal writing.
The lower_case_with_underscores is a lowercase letter, but is connected with an underscore.
Python ' s Coding Style