[Python-checkins] cpython (2.7): note that get() is not affected by default_factory (closes #13887)

benjamin.peterson python-checkins at python.org
Fri Jan 27 15:14:44 CET 2012


http://hg.python.org/cpython/rev/b2db66bc8e7f
changeset:   74658:b2db66bc8e7f
branch:      2.7
parent:      74646:8dec547c23d3
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
@@ -469,6 +469,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