我如何遵循 python PEP8 关于换行符的规定,它有多重要?
How do I follow python PEP8 regarding line breaks, and how important is it?
我在python3.5.1写的,我是编程小白
我使用带有 pep8 and pyflakes plugins showing style mistakes according to the python style guide 的 gedit。不知道要不要严格按照风格推荐。
但是,E501: line too long (80 > 79 characters)
、E502: the backslash is redundant between brackets
和 E128/E127/...: continuation line under-indented for visual indent
指出了三个反复出现的风格缺陷。截图如下。
我的两个问题是:
- 如何在 python 中适当地换行以避免
E501
以及随后的样式错误 E502
和 E127/128
?
- 严格遵循风格指南 pep8 是否有帮助,尤其是考虑到出版?高级 python 程序员怎么说?
E501:
E502:
E127/128...:
"How can I adequately make a line break in python in order to avoid E501 and the subsequent style errors E502 and E127/128?"
progress = Utils.ProgressMeter('Source strings separated by white '
'space are automatically concatenated by the '
'interpreter and parenthesis are the natural syntax '
'for line continuation. Remember to use trailing '
'spaces.')
由于错误 E502 已经在括号内,反斜杠是多余的。您尝试消除它了吗?
我在python3.5.1写的,我是编程小白
我使用带有 pep8 and pyflakes plugins showing style mistakes according to the python style guide 的 gedit。不知道要不要严格按照风格推荐。
但是,E501: line too long (80 > 79 characters)
、E502: the backslash is redundant between brackets
和 E128/E127/...: continuation line under-indented for visual indent
指出了三个反复出现的风格缺陷。截图如下。
我的两个问题是:
- 如何在 python 中适当地换行以避免
E501
以及随后的样式错误E502
和E127/128
? - 严格遵循风格指南 pep8 是否有帮助,尤其是考虑到出版?高级 python 程序员怎么说?
E501:
E502:
E127/128...:
"How can I adequately make a line break in python in order to avoid E501 and the subsequent style errors E502 and E127/128?"
progress = Utils.ProgressMeter('Source strings separated by white '
'space are automatically concatenated by the '
'interpreter and parenthesis are the natural syntax '
'for line continuation. Remember to use trailing '
'spaces.')
由于错误 E502 已经在括号内,反斜杠是多余的。您尝试消除它了吗?