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

4. Descriptors in the Standard Library

Jacob Zimmerman1 
(1)
New York, USA
 

There are three basic, well-known descriptors that come with Python: property, classmethod, and staticmethod. There’s also a fourth one that you use all the time, but are less likely to know is a descriptor.

Of all the descriptors being shown in this chapter, it’s possible that you only knew of property as a descriptor. Plenty of people even learn the basics of descriptors from it, but a lot of people don’t know that classmethod and staticmethod are descriptors. They feel like super magical constructs built into the language that no one could reproduce in pure Python. Once someone ...

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

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.