This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author mark.dickinson
Recipients gumtree, mark.dickinson, meador.inge
Date 2010-11-26.13:12:33
SpamBayes Score 0.000169705
Marked as misclassified No
Message-id <>
I think that's expected behaviour.  Note that int vs float behaves in the same way as float vs complex:

>>> class xint(int):
...     def __radd__(self, other):
...         print "__radd__"
...         return 42
>>> 3 + xint(5)
>>> 3.0 + xint(5)  # xint.__radd__ not called.

As with your example, the float.__add__ method is happy to deal with an int or an instance of any subclass of int.
Date User Action Args
2010-11-26 13:12:35mark.dickinsonsetrecipients: + mark.dickinson, gumtree, meador.inge
2010-11-26 13:12:35mark.dickinsonsetmessageid: <>
2010-11-26 13:12:33mark.dickinsonlinkissue5211 messages
2010-11-26 13:12:33mark.dickinsoncreate