class dot_dict(dict): """ Dictionary supporting .dot.notation, for setting and getting values """ def __getattr__(self, k): return self.__getitem__(k) def __setattr__(self, k, v): self.__setitem__(k, v) def __delattr__(self, k): self.__delitem__(k)ddict = dot_dict()ddict.it_just_works = 'with.dot_notation'ddict.it_just_works # If run using interactive mode, prints out the value set abovedel ddict.it_just_worksUsable and it just works, if you've got lot of dictionaries to work with, and don't like the normal way of dealing with traditional key name ['stuff'].
2019-10-20