Re: bool behavior in Python 3000?
On Wed, 11 Jul 2007 00:37:38 -0700, Rob Wolfe wrote:
Sorry I fail to see your point!? What has ``==`` to do with `cmp()` here?
The return of `cmp()` is an integer that cannot and should not be seen as
boolean value.
Ciao,
Marc 'BlackJack' Rintsch
On Wed, 11 Jul 2007 00:37:38 -0700, Rob Wolfe wrote:
Steven D'Aprano wrote:
>
>
But `bools` are usefull in some contexts. Consider this:
>
True
0
False
-1
>
At first look you can see that `cmp` does not return boolean value
what not for all newbies is so obvious.
>
>From a purely functional perspective, bools are unnecessary in Python. I
>think of True and False as syntactic sugar. But they shouldn't be
>syntactic sugar for 1 and 0 any more than they should be syntactic sugar
>for {"x": "foo"} and {}.
>think of True and False as syntactic sugar. But they shouldn't be
>syntactic sugar for 1 and 0 any more than they should be syntactic sugar
>for {"x": "foo"} and {}.
But `bools` are usefull in some contexts. Consider this:
>
>>>1 == 1
>>>cmp(1, 1)
>>>1 == 2
>>>cmp(1, 2)
>
At first look you can see that `cmp` does not return boolean value
what not for all newbies is so obvious.
The return of `cmp()` is an integer that cannot and should not be seen as
boolean value.
Ciao,
Marc 'BlackJack' Rintsch
Comment