For review: PEP 308 - If-then-else expression

David Eppstein eppstein at ics.uci.edu
Wed Feb 12 14:53:09 EST 2003


In article <mailman.1045024432.16082.python-list at python.org>,
 Andrew McNamara <andrewm at object-craft.com.au> wrote:

> Half baked idea warning - what about:
> 
>     Boolean:
> 
>         c -> { True: x, False: y }
> 
>     Int:
> 
>         c -> { 0: x, 1: y, 2: z }

Interesting syntax.  My biggest concern with it is that the right hand 
side looks just like a normal dictionary -- to do ternary operators 
correctly you'd want some kind of lazy evaluation there, but the 
laziness isn't apparent from the syntax.

-- 
David Eppstein       UC Irvine Dept. of Information & Computer Science
eppstein at ics.uci.edu http://www.ics.uci.edu/~eppstein/




More information about the Python-list mailing list