On 16.02.21 17:26, Steven D'Aprano wrote:
>>> from types import SimpleNamespace
>>> obj = SimpleNamespace()
>>> obj.spam = 1
>>> obj
namespace(spam=1)
Gives you a nice repr so when you are debugging you can actually see
what the object is.
I see that's Python 3 (vs. Python2.7 - yeah I know, legacy code). But
thanks for the remark! :-)
Still think that "object()" should be writable since this seems like an
arbitrary restriction (+SimpleNamespace is no builtin and at least I
would use object() for fast PoCs or dirty hackery). But I guess there's
been discussion around this already.
Best,
Sven
_______________________________________________
Python-ideas mailing list -- [email protected]
To unsubscribe send an email to [email protected]
https://mail.python.org/mailman3/lists/python-ideas.python.org/
Message archived at
https://mail.python.org/archives/list/[email protected]/message/4BOFWAJUQZ7E5UCP7NWRRBG6YN4CSN23/
Code of Conduct: http://python.org/psf/codeofconduct/