© Jacob Zimmerman 2018
Jacob ZimmermanPython Descriptorshttps://doi.org/10.1007/978-1-4842-3727-4_12

12. Instance-Level Descriptors

Jacob Zimmerman1 
(1)
New York, USA
 

What’s the most confusing part about a property-like data descriptor? Wrapping your head around the fact that it is being used to control instance-distinct attributes from its class.

What’s the hardest decision you have to make? Whether to store on the descriptor or on the instance (and then how you plan to accomplish that).

With instance properties, these issues are delegated to a nano framework so that you can concentrate on the important parts of your descriptor, creating a property that works the way you’d expect. Let’s get a little history to understand what I’m talking about.

Properties ...

Get Python Descriptors: Understanding and Using the Descriptor Protocol now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.