Fun python 3.2 one-liner

Chris Angelico rosuav at gmail.com
Tue Apr 5 11:19:06 EDT 2011


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?

Only partly tongue-in-cheek. I have code that quite legitimately has
gone to ten tabs in, and stayed there, and has on occasion gone as far
as 12-16. Generally I just scroll my display horizontally and ignore
the preceding tab levels. And sometimes I cheat a bit, in C or Pike,
and don't indent at some level; if it's a loop (or more likely a
switch) that surrounds the entire function, I might do:

void functionname(parameters) {while (cond)
{
	//code at one indent, not two
}}

Can't do that in Python - for better or for worse.

Chris Angelico



More information about the Python-list mailing list