"0 in [True,False]" returns True

Erik Max Francis max at alcyone.com
Tue Dec 13 10:30:52 CET 2005


Paul Rubin wrote:

> Steve Holden <steve at holdenweb.com> writes:
>> The really interesting question your post raises, though, is "Why do
>> you feel it's necessary to test to see whether a variable is a
>> Boolean?".
> 
> What's the point of having Booleans, if you can't tell them from integers?

Because

	return True

is clearer than

	return 1

if the purpose of the return value is to indicate a Boolean rather than 
an arbitrary integer.

-- 
Erik Max Francis && max at alcyone.com && http://www.alcyone.com/max/
San Jose, CA, USA && 37 20 N 121 53 W && AIM erikmaxfrancis
   The basis of optimism is sheer terror.
   -- Oscar Wilde



More information about the Python-list mailing list