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

Erik Max Francis max at alcyone.com
Wed Feb 12 18:51:53 EST 2003


Terry Reedy wrote:

> "John La Rooy" <nospampls.jlr at doctor.com> wrote:
>
> > 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 }
> >
> > Isn't this similar to
> >
> >     { True: x, False: y }[c]
> >
> > or
> >     { 0: x, 1: y, 2: z }[c]
> 
> Yes, or more concisely, (y,x)[c] and (x,y,z)[c].

... except for the short-circuiting functionality which was intended in
the first form.

-- 
 Erik Max Francis / max at alcyone.com / http://www.alcyone.com/max/
 __ San Jose, CA, USA / 37 20 N 121 53 W / &tSftDotIotE
/  \ You cannot step into the same river once.
\__/ Cratylus
    Python chess module / http://www.alcyone.com/pyos/chess/
 A chess game adjudicator in Python.




More information about the Python-list mailing list