summaryrefslogtreecommitdiffstats
path: root/Doc
diff options
context:
space:
mode:
authorJürgen Gmach <juergen.gmach@googlemail.com>2020-11-13 18:15:37 (GMT)
committerGitHub <noreply@github.com>2020-11-13 18:15:37 (GMT)
commitbbeb2d266d6fc1ca9778726d0397d9d6f7a946e3 (patch)
treeaffcf057592e7c84ce85a2fa12e98a3d59899b88 /Doc
parentf97406be4c0a02c1501c7ab8bc8ef3850eddb962 (diff)
downloadcpython-bbeb2d266d6fc1ca9778726d0397d9d6f7a946e3.zip
cpython-bbeb2d266d6fc1ca9778726d0397d9d6f7a946e3.tar.gz
cpython-bbeb2d266d6fc1ca9778726d0397d9d6f7a946e3.tar.bz2
bpo-42344: Improve pseudo implementation for SimpleNamespace (GH-23264)
Diffstat (limited to 'Doc')
-rw-r--r--Doc/library/types.rst4
1 files changed, 3 insertions, 1 deletions
diff --git a/Doc/library/types.rst b/Doc/library/types.rst
index ad40a9f..6f0dc25 100644
--- a/Doc/library/types.rst
+++ b/Doc/library/types.rst
@@ -409,7 +409,9 @@ Additional Utility Classes and Functions
return "{}({})".format(type(self).__name__, ", ".join(items))
def __eq__(self, other):
- return self.__dict__ == other.__dict__
+ if isinstance(self, SimpleNamespace) and isinstance(other, SimpleNamespace):
+ return self.__dict__ == other.__dict__
+ return NotImplemented
``SimpleNamespace`` may be useful as a replacement for ``class NS: pass``.
However, for a structured record type use :func:`~collections.namedtuple`