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

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


https://hg.python.org/cpython/rev/3115b6ce1006
changeset:   101069:3115b6ce1006
branch:      3.5
parent:      101066:e3763b5964b6
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