Tabs -vs- Spaces: Tabs should have won.

Steven D'Aprano steve+comp.lang.python at pearwood.info
Sun Jul 17 21:12:39 EDT 2011


Steven D'Aprano wrote:

> Roy Smith wrote:
> 
>> We don't have that problem any more.  It truly boggles my mind that
>> we're still churning out people with 80 column minds.  I'm willing to
>> entertain arguments about readability of long lines, but the idea that
>> there's something magic about 80 columns is hogwash.
> 
> I agree! Which is why I set my line width to 78 columns.

Sorry, that looks like a troll, but isn't.

I seriously do set my editor to a soft limit of 78 characters. That is, I
can exceed it if I want, but almost never do.

Why 78? Because it's one less than 79, as mandated by PEP 8, and two less
than 80, the hoary old standard. The reasons given in PEP 8 for 79 make
sense to me, and I don't like reading really long lines of code. With one
exception, if your line of code needs more than 79 plus or minus 1
characters, chances are it is doing too much.

The exception is, you have an indented block of code, perhaps three or four
indents deep (surely you never allow anything to get beyond five or six
indents?), and you want to raise an exception:

                raise SomeExceptionType("and here's a rather long error"
                                        "message blah blah blah")

If I only go a character or two over, I might be tempted to just go over.
But normally I split the line, as above, and use implicit line
concatenation.


http://www.python.org/dev/peps/pep-0008/


-- 
Steven




More information about the Python-list mailing list