代码规范 - Python代码,你会严格遵守PEP8吗?
PHPz
PHPz 2017-04-17 13:05:05
0
27
1845

Python代码,你会严格遵守PEP8吗?比如代码一行不超过79个字符,如果正好是80个字符,你会为了遵守PEP8而对代码进行调整吗?

PHPz
PHPz

学习是最好的投资!

reply all(27)
巴扎黑

Personally, I think following certain rules will make people who look at your code more comfortable.

If you use vim, it is recommended that you use this plug-in.

巴扎黑

Not necessarily. For example, pep does not recommend using *args **kwargs in methods. However, for the sake of code flexibility, I will consider not complying with pep8

阿神

pycharm will prompt you with obsessive-compulsive disorder

Ty80

Use autopep8 to automatically format the code. Except for the 80 characters per line, I will abide by everything else, otherwise the code will look very awkward

黄舟

Yes. If you use 80, you can open two windows in vim, and it is easier to write doc. I will abide by it, but don’t do it deliberately. For example, I am used to using single quotes to write docstring comments ' instead of double quotes ".

洪涛

I didn’t think it had to be like this. Once the IDE is set up, I don’t have to worry about it

黄舟

I know how to do it...The code I write will look good...and I want to upload it to github..Although no one will read it, I will always be afraid that someone will make noise...

洪涛

Must comply

PHPzhong

Complies with PEP8, which is more conducive to building a standard and readable code
In fact, I think PEP8 itself is still a very loose standard

刘奇

The length is set to 120, pep8 check is enabled by default

Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template