Booleans and comparison results

Roman Suzi rnd at onego.ru
Tue Jun 24 17:19:28 CEST 2003


Just a thought. Why cmp() returns -1,0,1 while comparison
results are False and True? Isn't it logical step to add
Less, Equal and More?

>>> cmp(1,2)
Less
>>> cmp(1,-1)
More
>>> cmp(1,1)
Equal


if cmp(foo, bar) is Less:
  ...

hmmm... Sadly, I know GvR is not going to add new keyword:

if cmp(foo, bar) are Equal:
  ...

;-)



Sincerely yours, Roman Suzi
-- 
rnd at onego.ru =\= My AI powered by GNU/Linux RedHat 7.3






More information about the Python-list mailing list