Fun python 3.2 one-liner

Steven D'Aprano steve+comp.lang.python at pearwood.info
Tue Apr 5 11:07:47 EDT 2011


On Tue, 05 Apr 2011 15:38:28 +0200, Daniel Fetchinson wrote:

>>> what is the character limit on a one liner :P.
>>
>> For PEP 8 compliance, 80 characters. :-)
> 
> Yeah, but we don't live in the 80's or 90's anymore and our screens can
> support xterms (or let alone IDE widows) much wider than 80 characters.
> I'm using 140 for python these days. Seriously, who would want to limit
> him/herself to 80 characters in 2011?

Seriously, or is that a rhetorical question?

People who like to have two source files side-by-side on a standard
sized monitor, or three on a wide-screen monitor.

People who need to read or edit source code on a virtual terminal rather 
than in a GUI console app.

People who print out source code to read later.

People with poor vision who need to use a significantly larger sized 
characters, and therefore can't fit as many on a line.

People who might want to email code snippets without having them 
inconveniently wrapped by the mail client.

People who don't like reading really long, overly complex, lines, and 
prefer to keep lines short for readability.

And most importantly... people who want to have their code accepted into 
the Python standard library.


Personally, I find that the discipline of keeping to 80 characters is 
good for me. It reduces the temptation of writing obfuscated Python one-
liners when two lines would be better. The *only* time it is a burden is 
when I write doc strings, and even then, only a small one.



-- 
Steven



More information about the Python-list mailing list