If you want to control how attributes are accessed or assigned to, you can use the special methods _getattr__, __setattr_ and _delattr__. You can also use descriptors which use the special methods __get__, __set_ and __del__. There are three built-in descriptors that cover pretty much every special case: @property, @staticmethod and @classmethod.
Join me on Discord: / discord
Support me by buying from Amazon through my affiliate link: https://amzn.to/2FBNVwA
Here's my Patreon account if you want to give me money: / realphysics
Other ways to support Real Physics: • How to Support Real Physics
Playlist: • Theory of Python
Thank you!