Trinary operator?
Grant Edwards
grante at visi.com
Wed Apr 17 14:45:50 EDT 2002
In article <a9kebg$ub9$1 at slb5.atl.mindspring.net>, Andrew Dalke wrote:
> Philipp Lenssen:
>>can I use something like
>> verboseGender = (gender == 'm') ? 'male' : 'female'
>>in Python?
>
> No. Search the archives for "ternary operator" for plenty of
> past discussion. Google lists 65 posts for comp.lang.python.
>
> Besides, for this specific case you should have some error checking,
> because there are genders other than 'male' and 'female' (eg,
> asexual bacteria and hermaphradite earthworms).
And in German, there's "neutral".
Unless we _are_ talking about bioligical stuff, then the term
you want is probably "sex" rather than "gender" (which I read
somewhere has always been a grammatical term not a biological
one until recently?), and you've may have to differentiate
between phenotype and genotype depending on the eventual use of
the data....
[somebody else has already posted a useful answer]
--
Grant Edwards grante Yow! Being a BALD HERO
at is almost as FESTIVE as a
visi.com TATTOOED KNOCKWURST.
More information about the Python-list
mailing list