summaryrefslogtreecommitdiffstats
path: root/Doc/library/types.rst
diff options
context:
space:
mode:
authorEric Snow <ericsnowcurrently@gmail.com>2013-02-16 23:32:39 (GMT)
committerEric Snow <ericsnowcurrently@gmail.com>2013-02-16 23:32:39 (GMT)
commitb5c8f927829a1679c6748df84a6289fb68343e51 (patch)
tree603f97f4653419d3afcf24feb534187ee9a8a051 /Doc/library/types.rst
parente924ddb23e4276b601cdc13d2988e501123f85fb (diff)
downloadcpython-b5c8f927829a1679c6748df84a6289fb68343e51.zip
cpython-b5c8f927829a1679c6748df84a6289fb68343e51.tar.gz
cpython-b5c8f927829a1679c6748df84a6289fb68343e51.tar.bz2
Issue #15022: Add pickle and comparison support to types.SimpleNamespace.
Diffstat (limited to 'Doc/library/types.rst')
-rw-r--r--Doc/library/types.rst2
1 files changed, 2 insertions, 0 deletions
diff --git a/Doc/library/types.rst b/Doc/library/types.rst
index 695480f..95132e8 100644
--- a/Doc/library/types.rst
+++ b/Doc/library/types.rst
@@ -212,6 +212,8 @@ Standard names are defined for the following types:
keys = sorted(self.__dict__)
items = ("{}={!r}".format(k, self.__dict__[k]) for k in keys)
return "{}({})".format(type(self).__name__, ", ".join(items))
+ def __eq__(self, other):
+ return self.__dict__ == other.__dict__
``SimpleNamespace`` may be useful as a replacement for ``class NS: pass``.
However, for a structured record type use :func:`~collections.namedtuple`