"0 in [True,False]" returns True

Ron Griswold RGriswold at Rioting.com
Tue Dec 13 05:28:39 EST 2005


I haven't read all of the responses to this thread, so perhaps this has
already been suggested. But it occurs to me that if one needs to
determine whether a variable is a bool or int it could be done like so:

>>> Booltype = False
>>> var = 0
>>> Booltype == var
True
>>> Booltype.__class__ == var.__class__
False

Ron Griswold
Character TD
R!OT Pictures
rgriswold at rioting.com




More information about the Python-list mailing list