operator overloading on built-ins

Steven Bethard steven.bethard at gmail.com
Fri Nov 9 08:04:38 CET 2007


r.grimm at science-computing.de wrote:
>>>> (1).__cmp__(10)
> -1

Integer object "(1)" followed by method call ".__cmp__(10)"

>>>> 1.__cmp__(10)
>   File "<stdin>", line 1
>     1.__cmp__(10)
>             ^
> SyntaxError: invalid syntax

Floating point number "1." followed by "__cmp__(10)".

STeVe



More information about the Python-list mailing list