[issue9930] Incorrect semantics of __radd__ method for builtin types

Mark Dickinson report at bugs.python.org
Thu Sep 23 21:23:03 CEST 2010


Mark Dickinson <dickinsm at gmail.com> added the comment:

If I understand correctly, the complaint is that (for example) in Python 3.x, we have:

Python 3.1.2 (r312:79147, Aug 20 2010, 20:06:00) 
[GCC 4.2.1 (Apple Inc. build 5664)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> float.__radd__(3.0, 1)
NotImplemented

while in Python 2.x:

Python 2.6.6 (r266:84292, Aug 28 2010, 18:05:46) 
[GCC 4.2.1 (Apple Inc. build 5664)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> float.__radd__(3.0, 1)
4.0

It's not clear to me whether there's any good reason for this change.



(I'm deliberately avoiding the original float + complex example, since complex is a little peculiar in 2.x for x <= 6 anyway---it's treated as an 'old-style' number (not to be confused with an old-style class)).

(Changing versions:  2.5 and 2.6 aren't getting bugfixes any more, and 2.7 appears to be behaving correctly.)

----------
nosy: +mark.dickinson

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue9930>
_______________________________________


More information about the Python-bugs-list mailing list