substitute for c/java's ?:

Jochen Riekhof jochen at riekhof.de
Thu Jun 14 11:40:38 EDT 2001


>return ("a","an")[name[0].lower() in "aeiou"]

Yeah, this is the method I found out for myself (see one of my above posts
in this thread).
Still has the drawback to evaluate both values of choice and much less
readable than ?: IMO.

Ciao

...Jochen








More information about the Python-list mailing list