Loading video player…

Python Descriptors (Overview)

Descriptors are a specific Python feature that power a lot of the magic hidden under the language’s hood. If you’ve ever thought that Python descriptors are an advanced topic with few practical applications, then this video course is the perfect tool to help you understand this powerful feature. You’ll come to understand why Python descriptors are such an interesting topic, and what kind of use cases you can apply them to.

By the end of this video course, you’ll know:

  • What Python descriptors are
  • Where they’re used in Python’s internals
  • How to implement your own descriptors
  • When to use Python descriptors

Resource mentioned in this lesson: Python Classes: The Power of Object-Oriented Programming

Download

Course Slides (.pdf)

3.4 MB
Download

Sample Code (.zip)

3.3 KB

00:00 Hey, hello and welcome to this course on Python Descriptors. Now, why should you be interested in descriptors? Well, the really cool thing about descriptors, in my opinion, is that they allow you to implement your own magic.

00:15 You’ll be diving into magic methods and you’ll be taking full control of what happens when class attributes are being used. So you will be investigating what goes on under the hood in Python classes.

00:29 So if you are the kind of person that is interested in what goes on under the hoods of Python things, then this course is definitely for you. Now a word of warning, maybe you will be looking at classes in quite a bit of detail, so you want to make sure that you’re up to speed with the basics when it comes to classes and class instances and attributes, for example.

00:53 If not, that’s okay. There’s a very helpful link in the resources section that you can check out beforehand.

01:01 You might also be picking up some new concepts such as protocols, for example, and something called the .__dict__ attribute. But I don’t think it’s essential that you read up on those things before we start, because I will cover the basics in this course.

01:20 So what will you be learning in this course more specifically? So, firstly, of course, what Python descriptors are. So you’ll start from a definition, and from that definition you will dive into things such as protocols and descriptor protocols and magical methods and magic behavior.

01:39 Then you will learn how to implement descriptors. So you will be writing some code, of course. There will be a song class, and then a string validator class.

01:47 And gradually, you will improve this code to make it more flexible and more usable. And finally, you’ll learn about something called the lookup chain, and you will learn that that is indeed how the magic is being implemented.

02:03 So those are the topics that I would like to take you through. My name is Steven Loyens, and I will be your instructor for this course. I’m very happy that you’re going on this journey with me.

02:14 So let’s dive straight in.

Become a Member to join the conversation.