Trinary operator?

Oyvind Gronnesby oyving+news at pvv.org
Wed Apr 24 20:02:54 EDT 2002


* Cliff Wells
|
| On 24 Apr 2002 22:57:20 +0200
| Oyvind Gronnesby wrote:
| 
| > * Cimarron Taylor
| > |
| > | Will this do what you want?
| > | 
| > | verboseGender = ('female','male')[gender=='m']
| > 
| > Wouldn't this break in a PEP 285 Python world?
| 
| No.  That was the whole point of subclassing bool from int.

But wouldn't that just imply that True/False would turn into 1/0 if coerced
into it by int()?

-- 
Øyvind Grønnesby
have castle, need dragon



More information about the Python-list mailing list