PEP-308 a "simplicity-first" alternative
holger krekel
pyth at devel.trillke.net
Tue Feb 11 20:02:32 EST 2003
Andrew Koenig wrote:
> holger> Inspired by "do the simplest thing that can possibly work" i
> holger> now think that
>
> holger> x and y else z
>
> holger> might just do it and avoid the need for a new construct.
>
> I thought so too when I first saw it, but now I'm less sure.
> For example, what is the meaning of
Damn, you get to the point where i was too lazy to think it out :-)
>
> w and x and y else z
(w and x) and y else z
should be the meaning.
> w and x and y else z else a
SyntaxError because it would be grouped as
((w and x) and y else z) else a
> (x and y) else z
SyntaxError aka "else requires preceding 'x and y' part".
Or in Grammar speek:
and_test: not_test ('and' not_test ['else' not_test])*
as far as i see it.
holger
More information about the Python-list
mailing list