Re: operator overloading on built-ins

2007-11-08 Thread Marc 'BlackJack' Rintsch
On Thu, 08 Nov 2007 22:53:16 -0800, r.grimm wrote: (1).__cmp__(10) > -1 As the dot is an operator like ``+`` or ``/`` you can also add spaces to avoid the ambiguity: In [493]: 1 . __cmp__(10) Out[493]: -1 In [494]: 1 .__cmp__(10) Out[494]: -1 Ciao, Marc 'BlackJack' Rintsch -- htt

Re: operator overloading on built-ins

2007-11-08 Thread Steven Bethard
[EMAIL PROTECTED] wrote: (1).__cmp__(10) > -1 Integer object "(1)" followed by method call ".__cmp__(10)" 1.__cmp__(10) > File "", line 1 > 1.__cmp__(10) > ^ > SyntaxError: invalid syntax Floating point number "1." followed by "__cmp__(10)". STeVe -- http://mail.pyt

operator overloading on built-ins

2007-11-08 Thread r . grimm
Hallo, could you explaint me the difference between the two following statements. Python 2.5 (r25:51908, Oct 7 2006, 23:45:05) [GCC 3.3.5 20050117 (prerelease) (SUSE Linux)] on linux2 Type "help", "copyright", "credits" or "license" for more information. >>> (1).__cmp__(10) -1 >>> 1.__cmp__(10)