I am writing in python 3.5.1 and I am a programming novice.
I use gedit with a pep8 and pyflakes plugins showing style mistakes according to the python style guide. I do not know whether to follow the style recommendation to the letter or not.
I have, however, three recurring style flaws indicated by E501: line too long (80 > 79 characters)
, E502: the backslash is redundant between brackets
and E128/E127/...: continuation line under-indented for visual indent
. Screenshots below.
My two questions are:
E501
and the subsequent style errors E502
and E127/128
?E501:
E502:
E127/128...:
PEP 8, sometimes spelled PEP8 or PEP-8, is a document that provides guidelines and best practices on how to write Python code. It was written in 2001 by Guido van Rossum, Barry Warsaw, and Nick Coghlan. The primary focus of PEP 8 is to improve the readability and consistency of Python code.
PEP8 is for humans but your program will run even if you do not follow it. If you do not share your code and do not plan to do so, do whatever you want. If you plan to share some part of your code someday, then you should follow PEP8. I mean, probably nobody will care if a few lines are 85 characters.
One blank line should be both before and after method definitions. You should use blank lines conservatively within your code to separate groups of functions.
Surround top-level function and class definitions with two blank lines. Method definitions inside a class are surrounded by a single blank line. Extra blank lines may be used (sparingly) to separate groups of related functions.
"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.')
Since error E502 is already inside parentheses, the backslash is redundant. Did you try eliminating it?
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With