PEP-308 a "simplicity-first" alternative

Raymond Hettinger vze4rx4y at verizon.net
Tue Feb 11 15:46:03 EST 2003


"holger krekel" <pyth at devel.trillke.net>
> Inspired by "do the simplest thing that can possibly work"
> i now think that
>
>         x and y else z

I don't think this works well in practice.
Does your mind quickly parse this:

    if x and y else z: print 'shrubery'

As this:

    if x:
        if y:
            print 'shrubery'
    else:
        if z:
            print 'shrubery'

Also, have you ever put a colon in the wrong place?

    if x and y else: z

This is currently valid, but has an entirely different
meaning.


Raymond Hettinger






More information about the Python-list mailing list