Descriptors: Why they are like Ninjas
summary
Any object that defines __get__/__set__/__delete__ automatically intercepts attribute lookup, and Python uses that to implement property, classmethod, staticmethod, super, slots and even functions as non-data descriptors that return bound methods. Demo builds a toy descriptor that prints cow emoji on get/set, and an ORM-style field descriptor that reads and writes a database row on attribute access. Examples run on CPython and show descriptors actually live on the class dict while instances only see returned values.
AI-written summary · about
