Fun python 3.2 one-liner

Steven D'Aprano steve+comp.lang.python at pearwood.info
Tue Apr 5 13:48:31 EDT 2011


On Wed, 06 Apr 2011 01:19:06 +1000, Chris Angelico wrote:

> On Wed, Apr 6, 2011 at 1:07 AM, Steven D'Aprano
> <steve+comp.lang.python at pearwood.info> wrote:
>> On Tue, 05 Apr 2011 15:38:28 +0200, Daniel Fetchinson wrote:
>>
>>> 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.
>>
>> And most importantly... people who want to have their code accepted
>> into the Python standard library.
> 
> Is that 80 including indentation, or excluding? And if including, does
> that put a hard limit of 20 indentation levels for standard library
> code?

Including.

As for the hard limit, pretty much.


> Only partly tongue-in-cheek. I have code that quite legitimately has
> gone to ten tabs in, and stayed there, 

"Legitimately"? I very much doubt it. (Only half joking.)


> and has on occasion gone as far as 12-16. 

I would consider anything more than four indents a code smell. That is, 
four is unexceptional; five would make me look over the code to see if it 
could be refactored; six would make me look at it *carefully*; eight 
would have me questioning my own sanity. I wouldn't give a hard limit 
beyond which I would "never" go beyond, but I find it difficult to 
imagine what drugs I'd need to be on to go beyond eight.

*wink* 




-- 
Steven



More information about the Python-list mailing list