PEP-308 a "simplicity-first" alternative
Bengt Richter
bokr at oz.net
Tue Feb 11 18:02:55 EST 2003
On Tue, 11 Feb 2003 20:32:25 +0100, holger krekel <pyth at devel.trillke.net> wrote:
>
>I am still wondering if there is a simple way to fix the current
>ternary op "x and y or z". Everybody knows by now that
>this "fails" if y is a false value. Otherwise
>it works ok and is used in today's code everywhere.
>
>Inspired by "do the simplest thing that can possibly work"
>i now think that
>
> x and y else z
>
>might just do it and avoid the need for a new construct.
>It's a very minor change just for fixing the problem at hand.
>It should be obvious what it does.
>
+1
I can live with that. Just have to accept that I didn't think of it ;-)
It fits well with the existing short circuiting, and should be
easy to get used to. Of course, I still think my
x -> y -> z
would be easy too (I won't mention what it is the simplest expression of ;-)
Regards,
Bengt Richter
More information about the Python-list
mailing list