Marc 'BlackJack' Rintsch wrote: > On Wed, 11 Jul 2007 00:37:38 -0700, Rob Wolfe wrote: > > > Steven D'Aprano wrote: > > > >> 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 {}. > > > > But `bools` are usefull in some contexts. Consider this: > > > >>>> 1 == 1 > > True > >>>> cmp(1, 1) > > 0 > >>>> 1 == 2 > > False > >>>> cmp(1, 2) > > -1 > > > > At first look you can see that `cmp` does not return boolean value > > what not for all newbies is so obvious. > > 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.
Before `bool` appeared it looked like this: >>> 1 == 1 1 >>> cmp(2, 1) 1 Wich result is boolean value? Rob -- http://mail.python.org/mailman/listinfo/python-list