[Python-checkins] cpython (3.2): note that get() is not affected by default_factory (closes #13887)
benjamin.peterson
python-checkins at python.org
Fri Jan 27 15:14:43 CET 2012
http://hg.python.org/cpython/rev/089a086252fc
changeset: 74656:089a086252fc
branch: 3.2
parent: 74654:e21dd3c1ca7e
user: Benjamin Peterson <benjamin at python.org>
date: Fri Jan 27 09:14:01 2012 -0500
summary:
note that get() is not affected by default_factory (closes #13887)
files:
Doc/library/collections.rst | 5 +++++
1 files changed, 5 insertions(+), 0 deletions(-)
diff --git a/Doc/library/collections.rst b/Doc/library/collections.rst
--- a/Doc/library/collections.rst
+++ b/Doc/library/collections.rst
@@ -468,6 +468,11 @@
:class:`dict` class when the requested key is not found; whatever it
returns or raises is then returned or raised by :meth:`__getitem__`.
+ Note that :meth:`__missing__` is *not* called for any operations besides
+ :meth:`__getitem__`. This means that :meth:`get` will, like normal
+ dictionaries, return ``None`` as a default rather than using
+ :attr:`default_factory`.
+
:class:`defaultdict` objects support the following instance variable:
--
Repository URL: http://hg.python.org/cpython
More information about the Python-checkins
mailing list