Discovering Descriptors

This talk was pre­sent­ed at Py­Con CZ 2017 and Eu­roPy­thon 2017. Here are the ref­er­ences and re­sources for the pre­sen­ta­tion.

The code used for the talk, is avail­able here and con­tains some ex­pla­na­tions along with the ex­am­ples.

Slides

Video

This is the record­ing of the talk pre­sent­ed at Eu­roPy­thon 2017.

References

To learn more about de­scrip­tors, you could check some of the fol­low­ing ref­er­ences, used as base for the talk:

  • Flu­ent Python - by Lu­­ciano Ra­­mal­ho: This book has a great cov­­er of all top­ics of Python, and de­scrip­­tors is no ex­­cep­­tion. Start­ing the sec­­tion V of meta-pro­­gram­ming, the chap­ter 20 con­­tains a pro­­found ex­­pla­­na­­tion of the in­­ter­­nals of de­scrip­­tors and how they work.

  • Python cook­­book (3rd edi­­tion) - David Bea­z­­ley & Bri­an Jones: Con­­tains great ex­am­­ples of Python code, that help ex­­plain­ing ad­­vanced top­ic­s, such as de­scrip­­tors, dec­o­ra­­tors, and more.

  • Python de­scrip­tors How­To: The nicest thing about this guide is not on­ly that helps a lot on the un­der­stand­ing of de­scrip­tors, but al­so that here you can find equiv­a­lent im­ple­men­ta­tions of many built-in de­scrip­tors in Python, for ex­am­ple those for @prop­er­ty, @class­method, etc. This helps a lot on the un­der­stand­ing of the in­ter­nals of Python, and il­lus­trates a part of the code that is im­ple­ment­ed in C in CPython.

  • Python da­­ta mod­­el: has a sec­­tion ex­­plain­ing the meth­ods of the de­scrip­­tor pro­­to­­col, and how they’re in­­­voked.

  • PEP-487 in­tro­duces __set_­name__.