Eric Snow's implementation of PEP 421.
Issue 14673: Add sys.implementation
diff --git a/Doc/library/types.rst b/Doc/library/types.rst
index fc26afa..b60b195 100644
--- a/Doc/library/types.rst
+++ b/Doc/library/types.rst
@@ -194,3 +194,27 @@
Return a new view of the underlying mapping's values.
+.. class:: SimpleNamespace
+
+ A simple :class:`object` subclass that provides attribute access to its
+ namespace, as well as a meaningful repr.
+
+ Unlike :class:`object`, with ``SimpleNamespace`` you can add and remove
+ attributes. If a ``SimpleNamespace`` object is initialized with keyword
+ arguments, those are directly added to the underlying namespace.
+
+ The type is roughly equivalent to the following code::
+
+ class SimpleNamespace:
+ def __init__(self, **kwargs):
+ self.__dict__.update(kwargs)
+ def __repr__(self):
+ keys = sorted(self.__dict__)
+ items = ("{}={!r}".format(k, self.__dict__[k]) for k in keys)
+ return "{}({})".format(type(self).__name__, ", ".join(items))
+
+ ``SimpleNamespace`` may be useful as a replacement for ``class NS: pass``.
+ However, for a structured record type use :func:`~collections.namedtuple`
+ instead.
+
+ .. versionadded:: 3.3