[pypy-issue] [issue944] Magic method exceptions

Armin Rigo tracker at bugs.pypy.org
Tue Nov 29 15:28:35 CET 2011


Armin Rigo <armin.rigo at gmail.com> added the comment:

No, Python is completely inconsistent.  For example:

<cpython>
>>> (2).__add__(None)
NotImplemented
>>> [].__add__(None)
TypeError: ...

The internal reason is that lists implement the C slot "sq_concat", whereas ints
implement the C slot "nb_add".  PyPy has no way to express that difference,
because it doesn't have internal slots that are different from the Python
methods.  It's one of the few remaining incompatibility, and has been decreed
acceptable.

Added documentation to cpython_differences.html.

----------
nosy: +arigo
status: unread -> wontfix

________________________________________
PyPy bug tracker <tracker at bugs.pypy.org>
<https://bugs.pypy.org/issue944>
________________________________________


More information about the pypy-issue mailing list