structure opened this issue on Jun 27, 2019 ยท 94 posts
adp001 posted Thu, 14 May 2020 at 9:36 AM
Simple method to save some typing while dealing with dicts:
class MyDict(dict):
def __getattr__(self, item):
if not item.startswith("_"):
return self.get(item)
return super(self.__class__, self).__getattribute__(item)
Instead of MyDict["keyword"]you can simplly write MyDict.keyword.