A very long time ago, I wrote an XML library (Gnosis Utilities xml_objectify) that had this same issue, and adopted the "duality" approach (where possible, with both dictionary and other styles also available). JSON is sort of the new XML, and it feels like the same concern. FWIW, LXML explicitly adopted my approach for an optional (mostly) compatible mode, and unlike me, they maintained that thing during the last 15 years since mine was touched.
However we get there, writing `obj.element.sub.another` is SO MUCH nicer.
On Wed, Apr 15, 2020 at 11:01 AM Paul Moore email@example.com wrote:
On Wed, 15 Apr 2020 at 15:41, Brett Cannon firstname.lastname@example.org wrote:
The "hey I'm a dict, but look over hear and now you can treat my like
like any other object" duality doesn't sit well with me. I do understand the idea of wanting to convert something to convert JSON data into a more object-like access pattern, though.
I don't like the duality, but I *do* like (in some situations) the object-with-dynamic-attributes style of access. Basically, when access is predominantly via literal strings and heavily nested,
is *far* more punctuation-heavy and (IMO) difficult to read as a consequence, than
Paul _______________________________________________ Python-Dev mailing list -- email@example.com To unsubscribe send an email to firstname.lastname@example.org https://mail.python.org/mailman3/lists/python-dev.python.org/ Message archived at https://email@example.com/message/RZQG5BIY... Code of Conduct: http://python.org/psf/codeofconduct/