Contribute Media
A thank you to everyone who makes this possible: Read More

Descriptors: attribute access redefined by Fraser Tweedale


Descriptors are a powerful feature of Python that can be used to augment or replace traditional attribute access with arbitrary behaviours. Such versatility makes the descriptor protocol a valuable tool for any Python programmer, yet although most of us have used descriptors, fewer have implemented one.

This presentation will explain the use cases that motivate descriptors and how other features in Python fall short. We will then look at some of the descriptors that the audience may already have used (even if they didn't know they were using descriptors!) This will be followed with an explanation of the descriptor protocol and some implementation and usage examples.

I will discuss some of the finer details of descriptor implementation and will conclude with a look at Elk - a declarative object system authored by the presenter and inspired by Perl's Moose - and the descriptors that power it.


Improve this page