One-liner blocks (was Re: accessing a functions var from a subfunction.)

Alex Martelli aleax at aleax.it
Thu Apr 17 09:55:52 EDT 2003


Courageous wrote:

>>Note that Guido deeply regrets permitting one-line blocks; this is
>>something he may try fixing for Python 3.0.
> 
> Eh? Rationale?

let me try to channel GvR (even though I'm quite a fan of one-line
blocks myself, particularly for such idioms as "if <xxx>: break")...:

Having MTOWTDI ain't Pythonic.  The ability to write either:

    if finished: break

OR quite equivalently

    if finished:
        break

is therefore a wart.  If only one of the two must survive, it's
clearly the second one (more general).  This will also ease the
task of semi-bright editors (right now, my GVIM tries to help
me by autoindenting right after each such "one-line block"...).


Alex





More information about the Python-list mailing list