[Python-checkins] cpython: Mention types.SimpleNamespace in collections.namedtuple doc

paul.moore python-checkins at python.org
Tue Apr 19 14:19:14 EDT 2016


https://hg.python.org/cpython/rev/c3232d1d8ca0
changeset:   101063:c3232d1d8ca0
user:        Paul Moore <p.f.moore at gmail.com>
date:        Tue Apr 19 19:17:16 2016 +0100
summary:
  Mention types.SimpleNamespace in collections.namedtuple doc

Issue #26805.

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
@@ -792,6 +792,11 @@
     Named tuple instances do not have per-instance dictionaries, so they are
     lightweight and require no more memory than regular tuples.
 
+    For simple uses, where the only requirement is to be able to refer to a set
+    of values by name using attribute-style access, the
+    :class:`types.SimpleNamespace` type can be a suitable alternative to using
+    a namedtuple.
+
     .. versionchanged:: 3.1
         Added support for *rename*.
 

-- 
Repository URL: https://hg.python.org/cpython


More information about the Python-checkins mailing list