PEP 308: Yet another syntax proposal.

Sean Ross sross at connectmail.carleton.ca
Fri Feb 14 14:13:39 EST 2003


+1, I like this(forget what I said abot "colons /usually/ mean blocks",
<wink>)
Sean
<sismex01 at hebmex.com> wrote in message
news:mailman.1045248651.18737.python-list at python.org...
> Following the discussion (and tossing another log
> into the flame), what do y'all think of this? It's
> modelled after lambda:, of course, but it's a short-
> circuiting expression:
>
> result = when <condition> : <trueval> else <falseval>
>
> The idea being that it's already a known form,
> except that instead of being lambda, it's "when".
>
> <trueval> and <falseval> are expressions, and as
> such, they can be also "when"-expressions, so it's
> linkable, for those perverts who like to do such
> things as:
>
>  R = when A: when B:t1 else t2 else when C:f1 else f2
>
> which would naturally parse into:
>
>  R = when A: (when B:t1 else t2) else (when C:f1 else f2)
>
> eek...
>
> OK, I'm gone for now.
>
> -gustavo
>






More information about the Python-list mailing list