4 ms·
It's easier and cleaner to write me.age instead of me['age'], especially when you have an expression with a lot of brackets.
by watchdogtimer 11y ago
It's easier and cleaner to write me.age instead of me['age'], especially when you have an expression with a lot of brackets.
- nostrademons 11y agoAlso a better upgrade path to a "real" class-based solution.
- jamiesonbecker 11y agoI do like namedtuples also. I definitely agree -- dot-based access is handy! Addict is a dict subclass that offers dot-based access (pip install addict) Shortcomings are that it's not in stdlib and does have a few quirks (for example, be sure to convert a Dict to a dict with .to_dict() before json'ing). However, it's a nice and well maintained module.