This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author jugmac00
Recipients jugmac00
Date 2020-11-13.13:42:06
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <>
When tinkering around with `SimpleNamespace` I tried to figure out the reasons for using it over just the `class NS: pass` alternative.

One reason is the comparison, which is not a plain `id` comparison, but an attribute comparison.

When looking at the documentation of the imaginary python implementation, where only dicts are compared, the reader (me) could think you can compare it to classes.

>>> from types import SimpleNamespace
>>> simple_ns = SimpleNamespace(a=1, b="two")

>>> class NS: pass
>>> class_ns = NS()
>>> class_ns.a = 1
>>> class_ns.b = "two"

>>> simple_ns == class_ns
>>> False

Actually, the C implementation compares the types, too.

While the documentation says the Python impl is "roughly equivalent", 
I's still suggest to update the documentation.

If there is some agreement, I'd create a pull request.
Date User Action Args
2020-11-13 13:42:06jugmac00setrecipients: + jugmac00
2020-11-13 13:42:06jugmac00setmessageid: <>
2020-11-13 13:42:06jugmac00linkissue42344 messages
2020-11-13 13:42:06jugmac00create