Managing Attribute Access and Descriptors (Theory of Python) (Python Tutorial)

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: https://discord.gg/TGK47Pf

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: https://www.patreon.com/realphysics

Other ways to support Real Physics: https://youtu.be/44nldGgJCiw

Playlist: https://www.youtube.com/playlist?list=PLMcpDl1Pr-vjYjuPLs5wnbzf48ytUHRrb

Thank you!

Post Author: hatefull