Help me understand this

Beej beej at beej.us
Tue Jan 30 15:48:06 EST 2007


On Jan 30, 9:52 am, Jean-Paul Calderone <exar... at divmod.com> wrote:
> 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 ".".

Which leads to these two beauties:

>>> (2.).__add__(1)
3.0
>>> 2..__add__(1)
3.0

I like the second one more. :-)

-Beej





More information about the Python-list mailing list