"0 in [True,False]" returns True

bonono at gmail.com bonono at gmail.com
Tue Dec 13 05:02:16 EST 2005


Erik Max Francis wrote:
> 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.
>
True, but if that is the only reason, Two built-in value of
True/False(0/1) serves the need which is what is now(well sort of). Why
have seperate types and distinguish them ?

>>>True == 1
True
>>>True is 1
False




More information about the Python-list mailing list