I use argparse.Namespace whenever I need this.
In reply to Chris Barker's concern of "is this code or is this data", the last time I used it is when I needed to hold an external function reference in an object instance (if I assigned it to an attribute, it was converted into an instance method). It just didn't feel right to invoke it via a container lookup.
A telling name for the object also clears doubts about what it's supposed to hold.
On 29.11.2017 11:52, Serhiy Storchaka wrote:
In 3.7 I have removed an old-deprecated plistlib.Dict.  Actually it already was deprecated when the plistlib module was added to the regular stdlib in Python 2.6.
This is a dict subclass which allows to access items as attributes.
d = plistlib.Dict() d['a'] = 1 assert d.a == 1 d.b = 2 assert d['b'] == 2
Raymond noticed that that capability seemed nice to have.
What do you think about reviving this type as general purpose type in collections or types? Perhaps it can be convenient for working with JSON, plists, configuration files, databases and in other cases that need a dict with string keys.
If reintroduce it, there are open questions.
The name of the type.
The location of the type. collections or types? Or other variants?
How it will collaborate with OrderedDict, defaultdict, etc?
Should it be a dict subclass, or a mixin, or a proxy? Or add
Python-ideas mailing list Pythonfirstname.lastname@example.org https://mail.python.org/mailman/listinfo/python-ideas Code of Conduct: http://python.org/psf/codeofconduct/