On 29/11/2017 23:34, Chris Barker wrote:
On Wed, Nov 29, 2017 at 12:52 AM, Serhiy Storchaka <email@example.com mailto:firstname.lastname@example.org> wrote:
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 What do you think about reviving this type as general purpose type in collections or types
Am I I the only one that thinks this is a "Bad Idea"?
For me, it simply confuses even more the question of "is this code or is this data?" -- which is a difficult enough design question in a dynamic language.
And the couple of libraries I"ve worked with that do this I liked at first, but grew to find problematic.
I have also implemented something like this (as a convenience, to hold a row from an SQL table). But it never occurred to me that there should be something like it in the stdlib. Rob Cliffe