For review: PEP 308 - If-then-else expression
Terry Reedy
tjreedy at udel.edu
Wed Feb 12 11:32:05 EST 2003
"John La Rooy" <nospampls.jlr at doctor.com> wrote in message
news:20030212174748.0b66941b.nospampls.jlr at doctor.com...
> On Wed, 12 Feb 2003 15:27:13 +1100
> 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]. tjr
More information about the Python-list
mailing list