Override __getattr__ in Python

Magic methods or Dunder methods in Python are the methods having two underscores around the method's name. "Dunder" isn't some fictional city in Scranton, but it means “Double Under (Underscores)”. These are commonly used for operator overloading. Few examples for magic methods are: __init__, __add__, __len__, __repr__ etc.


There are many methods like these but emphasizing particularly on __getattr__, is called when an atrribute is not found in the usual place(i.e. it is not an instance attrib...

 •  0 comments  •  flag
Share on Twitter
Published on June 09, 2020 15:32
No comments have been added yet.