Python代码,你会严格遵守PEP8吗?比如代码一行不超过79个字符,如果正好是80个字符,你会为了遵守PEP8而对代码进行调整吗?
天蓬老师2017-04-17 13:07:05
The rest basically depends on the pep8 checker...
阿神2017-04-17 13:07:05
PEP8 is a recommended standard. The purpose of the standard is to unify code formats and habits, thus reducing reading costs to the greatest extent.
The principle I follow is that I can abide by it if I want to, and if others don't abide by it, I can't.
To put it bluntly, it is to make the code more readable.
So if I don’t comply with PEP8, will it be unreadable?
The variable names are easy to understand, the core code is commented in detail, the functional modules come with test cases, the modules have a reasonable structure and appropriate relationships, and the documentation is detailed. I think all of them are more important than PEP8.
Of course, it is better to follow PEP8, but how many masters just like to write code that is concise and simple. Once you get used to it, the readability will be much better. If you want to be serious about such code and do not follow PEP8, you are a python novice, then you can only Noh chuckled.
巴扎黑2017-04-17 13:07:05
1, Automation tool https://pypi.python.org/pypi/...
2, IDE pycharm will prompt you whether what you write complies with the pep8 specification