[Python-Dev] PEP 8 modernisation

Nick Coghlan ncoghlan at gmail.com
Thu Aug 1 23:48:07 CEST 2013


On 2 Aug 2013 01:18, "Alexander Belopolsky" <alexander.belopolsky at gmail.com>
wrote:
>
>
> On Thu, Aug 1, 2013 at 10:21 AM, R. David Murray <rdmurray at bitdance.com>
wrote:
>>
>> > I'm guessing it's short enough you can say you tried, but long
>> > enough to annoy traditionalists anyway.
>> >
>> > I'm annoyed already.  :-)
>>
>> +1 :)
>
>
> +1 :)
>
> I recently gave up and reset default auto-wrap margin to 120 locally.
 This change had little effect on code because most line breaks in code are
inserted manually anyways.   However, docstrings are beginning to suffer.
 The "short description" line is not that short anymore and multi-paragraph
prose filled between 4- and 120-characters margin is hard to read.
>
> I will start experimenting with 100-char limit, but I think it is still
too wide for auto-wrapped text.   Maybe we should have a stronger
recommendation to keep 80-char limit for docstrings and other embedded
text.   It is OK to have an occasional long line in code,  but readability
suffers when you have every line close to 100 chars.

1. The recommended length limit for flowed text is still *72* (since it
doesn't have the structural constraints code does).
2. The preferred length limit for code is still 79.

The "up to 99 if it improves readability" escape clause was added because
Guido deemed the occasional long line a lesser evil than the contortions he
has seen people apply to code to stay within the 79 character limit (most
notably, using cryptic variable names because they're shorter).

That entire section of the PEP was completely rewritten - we didn't just
s/79/99/ with the old content.

Cheers,
Nick.

>
> Another observation is that long lines in code are usually heavily
indented.  This makes them still readable because non-white characters
still fit within the field of view.   Again, this is not the case for
docstrings, comments or other embedded  prose.
>
> _______________________________________________
> Python-Dev mailing list
> Python-Dev at python.org
> http://mail.python.org/mailman/listinfo/python-dev
> Unsubscribe:
http://mail.python.org/mailman/options/python-dev/ncoghlan%40gmail.com
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-dev/attachments/20130802/6e0e1e73/attachment.html>


More information about the Python-Dev mailing list