[Python-ideas] PEP 8 and long string literals

Jonathan Fine jfine2358 at gmail.com
Mon Feb 25 04:49:59 EST 2019


I've started this thread, because I think long string literals are
somewhat special, and may have an easy resolution.

According to PEP 8 a good reason to ignore the line-length (or any
other) guideline is that "applying the guideline would make the code
less readable, even for someone who is used to reading code that
follows this PEP."

PEP 8 also says "Limit all lines to a maximum of 79 characters."

So perhaps it is enough, for long string literals, to add a note to
PEP 8: When sensible to do so, lines containing a long string literal
can exceed this length.

It might also help to add to PEP 8 some Programming Recommendations
for Long String Literals. (PEP 8 already has recommendations for
Function and Variable Annotations.)

Finally, tools such as pep8 and pylint would need some changes, to
treat differently lines that contain a long string constant.

-- 
Jonathan


More information about the Python-ideas mailing list