Re: "0 in [True,False]" returns True
Erik Max Francis wrote:[color=blue]
> Paul Rubin wrote:
>[color=green]
> > Steve Holden <steve@holdenwe b.com> writes:[color=darkred]
> >> 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?".[/color]
> >
> > What's the point of having Booleans, if you can't tell them from integers?[/color]
>
> 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.
>[/color]
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 ?
[color=blue][color=green][color=darkred]
>>>True == 1[/color][/color][/color]
True[color=blue][color=green][color=darkred]
>>>True is 1[/color][/color][/color]
False
Erik Max Francis wrote:[color=blue]
> Paul Rubin wrote:
>[color=green]
> > Steve Holden <steve@holdenwe b.com> writes:[color=darkred]
> >> 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?".[/color]
> >
> > What's the point of having Booleans, if you can't tell them from integers?[/color]
>
> 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.
>[/color]
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 ?
[color=blue][color=green][color=darkred]
>>>True == 1[/color][/color][/color]
True[color=blue][color=green][color=darkred]
>>>True is 1[/color][/color][/color]
False
Comment