Locked learning resources

Join us and get access to thousands of tutorials and a community of expert Pythonistas.

Unlock This Lesson

Locked learning resources

This lesson is for members only. Join us and get access to thousands of tutorials and a community of expert Pythonistas.

Unlock This Lesson

Python Descriptors (Summary)

Now that you know how Python uses descriptors to power some of its great features, you’ll be a more conscious developer who understands why some Python features have been implemented the way they are.

You’ve learned:

  • What Python descriptors are and when to use them
  • Where descriptors are used in Python’s internals
  • How to implement your own descriptors

Resources linked in this lesson:

Locked learning resources

Join us and get access to thousands of tutorials and a community of expert Pythonistas.

Unlock This Lesson

Already a member? Sign-In

Locked learning resources

The full lesson is for members only. Join us and get access to thousands of tutorials and a community of expert Pythonistas.

Unlock This Lesson

Already a member? Sign-In

00:00 Well, congratulations. You have reached to the end of this course on Python Descriptors. And you have learned quite a few things in this course. Firstly, what Python descriptors are, you started from the definition.

00:14 You then looked at protocols and in particular, you looked at the descriptor protocol, and you looked at descriptive classes that implement the descriptor protocol, and then the special behavior that those classes exhibit.

00:29 You then looked at how to implement descriptors, so you wrote a Song class, and you also wrote the string validated descriptor class to validate the song title.

00:40 Then gradually you made the code more dynamic, and then with a few lines of code, you also implemented that same string validated descriptor class to the artist’s name.

00:52 And finally, you learned about the lookup chain, which is this priority list Python uses to look for attribute values when the dot notation is being used, and you learned that descriptors sit somewhere on that priority list, and that is how you can implement the magic.

01:12 Now, there are a few resources I would highly recommend you have a look at. Firstly, of course, there is the written tutorial that sits behind this video course.

01:22 Now there’s more detail in that written tutorial. There’s also a section that talks about how Python itself uses descriptors to implement properties, for example, or to implement static methods and class methods.

01:38 This course talked about classes, of course, in quite a bit of detail. So if you need to brush up your knowledge on classes, then there is the Power of Object-Oriented Programming, and then there are Python protocols that you looked at just before implementing the descriptor protocol.

01:56 And then, as I mentioned during the course, there is a link to Single and Double Underscore Naming Conventions in Python, Namespace in Python, and Working with Python’s .__dict__ Attribute.

02:08 So again, congratulations and all that’s left to do is for me to say thank you for taking this course, and I hope you enjoyed the course just as much as I have enjoyed making it.

02:20 See you in the next one.

Become a Member to join the conversation.