ternary operator

Christopher A. Craig list-python at ccraig.org
Thu Feb 6 11:41:55 EST 2003


Paul Foley <see at below.invalid> writes:

> On 05 Feb 2003 09:49:33 -0500, Christopher A Craig wrote:
> 
> > gausebec-spam at paypal.com (David Gausebeck) writes:
> >> 2) Is there any better workaround than the ones I've listed above?
> 
> > if a: x = b
> > else: x = c
> 
> Urk.  There really ought to be a PSU death squad dedicated to hunting
> down people who write code like that!

You like (b, c)[not a] better?  I generally don't write code like
that, but it is more compact than the prefered way and anything is
better than the perl-line-noise-eqsue ternery work alikes that are
available.

-- 
Christopher A. Craig <list-python at ccraig.org>
Why be ISO9000 Compliant when you can be ISO9660 Compliant?





More information about the Python-list mailing list