Booleans and comparison results

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Roman Suzi

    Booleans and comparison results


    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?
    [color=blue][color=green][color=darkred]
    >>> cmp(1,2)[/color][/color][/color]
    Less[color=blue][color=green][color=darkred]
    >>> cmp(1,-1)[/color][/color][/color]
    More[color=blue][color=green][color=darkred]
    >>> cmp(1,1)[/color][/color][/color]
    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
    --
    [email protected] =\= My AI powered by GNU/Linux RedHat 7.3


Working...