[pypy-commit] pypy default: Document __len__/__length_hint__.

arigo noreply at buildbot.pypy.org
Thu Jun 7 11:19:05 CEST 2012

Author: Armin Rigo <arigo at tunes.org>
Changeset: r55458:5c7fa43f9bb6
Date: 2012-06-07 11:18 +0200

Log:	Document __len__/__length_hint__.

diff --git a/pypy/doc/cpython_differences.rst b/pypy/doc/cpython_differences.rst
--- a/pypy/doc/cpython_differences.rst
+++ b/pypy/doc/cpython_differences.rst
@@ -324,5 +324,10 @@
   type and vice versa. For builtin types, a dictionary will be returned that
   cannot be changed (but still looks and behaves like a normal dictionary).
+* the ``__len__`` or ``__length_hint__`` special methods are sometimes
+  called by CPython to get a length estimate to preallocate internal arrays.
+  So far, PyPy never calls ``__len__`` for this purpose, and never calls
+  ``__length_hint__`` at all.
 .. include:: _ref.txt

More information about the pypy-commit mailing list