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

Getters and Setters in Python (Summary)

Now you know what getter and setter methods are and where they come from. These methods allow access and mutation of attributes while avoiding API changes. However, they’re not so popular in Python because of the existence of properties. Properties allow you to add behavior to your attributes while avoiding breaking changes in your APIs.

Even though properties are the Pythonic way to replace traditional getters and setters, properties can have some practical drawbacks that you can overcome with getters and setters.

In this video course, you’ve learned how to:

  • Write getter and setter methods in Python
  • Use Python properties to replace getter and setter methods
  • Use Python tools, like descriptors, to replace getters and setters
  • Decide on when setter and getter methods can be the right tool for the job

To learn more about the concepts in this course, check out:

Download

Sample Code (.zip)

3.2 KB
Download

Course Slides (.pdf)

4.9 MB

Become a Member to join the conversation.