Talk

Descriptors made easy

Thursday, May 23

11:40 - 12:25
RoomPanino
LanguageEnglish
Audience levelIntermediate
Elevator pitch

Descriptors used to confuse the heck out of time…

But then, one day, it clicked! 💡

As soon as they clicked, I started preparing this talk so that descriptors can also click for you!

And that’s what I’ll do: I’ll make sure you understand descriptors for good.

Abstract

Descriptors are one of those things that many don’t even bother to learn because they look confusing.

Thankfully for you, I cracked the code and I can assure you they’re not confusing!

In this talk I will provide an example that shows how descriptors work and that will also motivate why they are useful and needed.

By the time we are done, you will be able to implement descriptors in your code and use them for practical purposes.

Outline

The talk will follow roughly these bullet points:

  • introduction
  • @property and getter methods
  • the dunder method __get__
  • a descriptor example
  • identify a similarity between @property and __get__
  • `@property.setter` and setter methods
  • the dunder method __set__
  • another descriptor example
  • how to create general descriptors & the dunder method __set_name__
  • explain why @property and descriptors look so similar
  • give examples of situations where descriptors are needed
  • if time permits, talk about some built-in descriptors
TagsAbstractions
Participant

Rodrigo Girão Serrão

Rodrigo has always been fascinated by problem solving and that is why he picked up programming – so that he could solve more problems. He also loves sharing knowledge, and that is why he spends so much time writing articles in his blog mathspp.com/blog, writing on Twitter @mathsppblog, and giving workshops and courses. You can also find his past talks on github.com/mathspp/talks.

His main areas of scientific interest are mathematics (numerical analysis in particular) and programming in general (with a preference for the Python and APL languages), but Rodrigo also enjoys reading fantasy books, watching silly comedy movies and eating chocolate.