Welcome to Software Development on Codidact!
Will you help us build our independent community of developers helping developers? We're small and trying to grow. We welcome questions about all aspects of software development, from design to code to QA and more. Got questions? Got answers? Got code you'd like someone to review? Please join us.
Post History
It is useful sometimes, for example consider a program accepting input in the form of templates. An input of "Value: {obj.field}" is more readable than "Value: {obj['field']}". Such an examp...
Answer
#1: Initial revision
1. It is useful sometimes, for example consider a program accepting input in the form of templates. An input of `"Value: {obj.field}"` is more readable than `"Value: {obj['field']}"`. - Such an example is an app processing JSON and evaluating expressions on it, like `jq` or a similar Python app, [`pjy`](https://pypi.org/project/pjy/): `pjy d.item.subitem` instead of `pjy "d['item']['subitem']"` 2. There are other ways to do it: - Subclass dict and implement `def __getattr__(self, attr): return self[attr]` - Use `self.__dict__` instead of `self._dictionary`