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 -- python-ideas@python.org
To unsubscribe send an email to python-ideas-le...@python.org
https://mail.python.org/mailman3/lists/python-ideas.python.org/
Message archived at 
https://mail.python.org/archives/list/python-ideas@python.org/message/4BOFWAJUQZ7E5UCP7NWRRBG6YN4CSN23/
Code of Conduct: http://python.org/psf/codeofconduct/

Reply via email to