1. Pypy
  2. Untitled project
  3. pypy


Armin Rigo  committed 5a5b5c4

Document this difference

  • Participants
  • Parent commits 9b2dff9
  • Branches default

Comments (0)

Files changed (1)

File pypy/doc/cpython_differences.rst

View file
  • Ignore whitespace
   implementation detail that shows up because of internal C-level slots
   that PyPy does not have.
+* on CPython, ``[].__add__`` is a ``method-wrapper``, and
+  ``list.__add__`` is a ``slot wrapper``.  On PyPy these are normal
+  bound or unbound method objects.  This can occasionally confuse some
+  tools that inspect built-in types.  For example, the standard
+  library ``inspect`` module has a function ``ismethod()`` that returns
+  True on unbound method objects but False on slot wrappers.  On PyPy we
+  can't tell the difference, and so ``ismethod(list.__add__)`` has to
+  return True.
 * the ``__dict__`` attribute of new-style classes returns a normal dict, as
   opposed to a dict proxy like in CPython. Mutating the dict will change the
   type and vice versa. For builtin types, a dictionary will be returned that