[pypy-commit] pypy default: This is probably worth more than just an obscure sentence in an obscure topic --- although it is obscure too, it is probably more common.
arigo
noreply at buildbot.pypy.org
Fri Aug 19 01:29:51 CEST 2011
Author: Armin Rigo <arigo at tunes.org>
Branch:
Changeset: r46621:79fb6da04aae
Date: 2011-08-19 01:33 +0200
http://bitbucket.org/pypy/pypy/changeset/79fb6da04aae/
Log: This is probably worth more than just an obscure sentence in an
obscure topic --- although it is obscure too, it is probably more
common.
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
@@ -287,7 +287,14 @@
never a dictionary as it sometimes is in CPython. Assigning to
``__builtins__`` has no effect.
-* object identity of immutable keys in dictionaries is not necessarily preserved.
- Never compare immutable objects with ``is``.
+* Do not compare immutable objects with ``is``. For example on CPython
+ it is true that ``x is 0`` works, i.e. does the same as ``type(x) is
+ int and x == 0``, but it is so by accident. If you do instead
+ ``x is 1000``, then it stops working, because 1000 is too large and
+ doesn't come from the internal cache. In PyPy it fails to work in
+ both cases, because we have no need for a cache at all.
+
+* Also, object identity of immutable keys in dictionaries is not necessarily
+ preserved.
.. include:: _ref.txt
More information about the pypy-commit
mailing list