For review: PEP 308 - If-then-else expression
A. Lloyd Flanagan
alloydflanagan at attbi.com
Fri Feb 28 17:00:50 EST 2003
> Half baked idea warning - what about:
>
> Boolean:
>
> c -> { True: x, False: y }
>
> Int:
>
> c -> { 0: x, 1: y, 2: z }
If you use the same notation as for creating a dictionary, it will be
unobvious (to put it mildly) that options not selected are never
evaluated. Just looking at this, I would expect it to behave like:
{ True: x, False: y }[c]
More information about the Python-list
mailing list