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

Managing Attributes With Python's property() (Summary)

A property is a special type of class member that provides functionality that’s somewhere in between regular attributes and methods. Properties allow you to modify the implementation of instance attributes without changing the public API of the class. Being able to keep your APIs unchanged helps you avoid breaking code your users wrote on top of older versions of your classes.

Properties are the Pythonic way to create managed attributes in your classes. They have several use cases in real-world programming, making them a great addition to your skill set as a Python developer.

In this video course, you learned how to:

  • Create managed attributes with Python’s property()
  • Perform lazy attribute evaluation and provide computed attributes
  • Avoid setter and getter methods with properties
  • Create read-only, read-write, and write-only attributes
  • Create consistent and backwards-compatible APIs for your classes

If you’d like to learn more about the concepts covered in this course, then check out:

Download

Sample Code (.zip)

6.4 KB
Download

Course Slides (.pdf)

4.4 MB

Become a Member to join the conversation.