PEP 308: Yet another syntax proposal.

sismex01 at sismex01 at
Fri Feb 14 19:45:51 CET 2003

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)


OK, I'm gone for now.


More information about the Python-list mailing list