How can I keep an eye on PEP8 python regarding line breaks and how important is this?

I am writing in python 3.5.1 and I am starting to program.

I am using gedit with pep8 and pyflakes displaying style errors according to the python style guide . I do not know whether to follow the style recommendations for writing or not.

I do, however, have three recurring style flaws designated 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:

  • How can I adequately make line breaks in python to avoid E501 and subsequent E502 and E127/128 style errors?
  • Is it helpful to follow the pep8 style guide to writing, especially with the publication? What do Python programmers say?

E501: enter image description here

E502: enter image description here

E127 / 128 ...: enter image description here

+5
source share
1 answer

"How can I adequately make line breaks in python to avoid E501 and subsequent E502 and E127 / 128 style errors?"

 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 the E502 error is already in parentheses, the backslash is redundant. Have you tried to fix it?

+5
source

Source: https://habr.com/ru/post/1240913/


All Articles