[issue40284] Add mapping methods to types.SimpleNamespace

Raymond Hettinger report at bugs.python.org
Tue Apr 14 17:40:54 EDT 2020


Raymond Hettinger <raymond.hettinger at gmail.com> added the comment:

> I would prefer that SimpleNamespace remains as simple as it is

This doesn't affect the simplicity of the current API at all.  If you don't need the feature, you won't even notice the extension.

> If you want to add the mapping protocol, I suggest you to create
> your own subclass and add the methods that you want

I do that for myself.  However, users would greatly benefit from having this an option.

We don't ask users to write their own defaultdicts from scratch even though that is simple dict subclass.  Providing this tool would instantly benefit a broad class of json users.

----------

_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue40284>
_______________________________________


More information about the Python-bugs-list mailing list