PEP8 and 4 spaces

Chris Angelico rosuav at gmail.com
Sun Jul 6 03:28:21 CEST 2014


On Sun, Jul 6, 2014 at 11:18 AM, Dan Sommers <dan at tombstonezero.net> wrote:
> On Sun, 06 Jul 2014 09:27:59 +1000, Chris Angelico wrote:
>
>> How often do you ever have multiple consecutive blank lines? My
>> newlines are either single (line end) or in pairs (one blank line),
>> and I don't remember having anything else (at least, not
>> intentionally). Greater separation than a blank line is provided by
>> comments, not more whitespace.
>>
>> ChrisA
>
> http://legacy.python.org/dev/peps/pep-0008/#id15 says:  "Separate top-level
> function and class definitions with two blank lines."
>
> With docstrings occurring inside function definitions, this happens quite a
> bit.

Ah, okay. Still, it's not something that scales up much, the way
horizontal whitespace does. You go to 2 blanks, and extras (sparingly)
between groups, but it's not like indentation, where nesting naturally
requires progressively more space. If you're nesting groups of
functions like that, you probably should be using something other than
whitespace (maybe separate files?).

ChrisA



More information about the Python-list mailing list