python - 这样的代码符合PEP8标准吗?
大家讲道理
大家讲道理 2017-04-18 09:42:08
0
4
405

在sublime装了个自动转化代码为PEP8标准的插件。

下面的图是转化后,怎么感觉看着不是很舒服。这样的代码是规范的吗?我还需要继续使用这个插件吗?

还有

output_path = "%s/%s/%s.m4a" % (variables.VIDEO_STORE_PATH, video.id, base_name)

=>

output_path = "%s/%s/%s.m4a" % (variables.VIDEO_STORE_PATH,
                                video.id, base_name)

是不是有点别扭...

大家讲道理
大家讲道理

光阴似箭催人老,日月如移越少年。

reply all(4)
洪涛

pep8 has related plug-in detection, just use it to check it, and errors will be reported where errors should be reported

小葫芦

It’s very consistent, especially, at a glance, you can tell it’s a line break within the brackets

output_path = "%s/%s/%s.m4a" % (variables.VIDEO_STORE_PATH,
                                video.id, base_name)
大家讲道理

Installation pep8:

pip install --upgrade autopep8

After

run:

autopep8 --in-place --aggressive --aggressive <filename>

will automatically adjust your code to the pep8 style, and then you can compare it with your previous style to see if it matches.

刘奇

Compliant. The reason for line breaks is because pep8 stipulates line length, and we generally follow 79 characters or less.
https://www.python.org/dev/pe...

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