Help me understand this

Marc 'BlackJack' Rintsch bj_666 at gmx.net
Tue Jan 30 13:18:18 EST 2007


In <mailman.3318.1170179562.32031.python-list at python.org>, Jean-Paul
Calderone wrote:

>>An integer is a primary so 2.__add(1) should be valid.
> 
> A float is, too.  2.__add is a float followed by an identifier.
> Not legal.  As pointed out elsewhere in the thread, (2). forces
> it to be an integer followed by a ".".

A space between the integer literal and the dot operator works too:

In [1]: 2 .__add__(1)
Out[1]: 3

Ciao,
	Marc 'BlackJack' Rintsch



More information about the Python-list mailing list