In this liveProject, you’ll take on the task of extending a pricing application. You’ve just hit your first speed bump of needing to add functionality to the class that manages prices. However, that class is used elsewhere and you can’t get permission to change it. Your challenge is to implement a “monkey patch”—adding methods to the class at runtime—by experimenting with Python-bound methods.
This project is designed for learning purposes and is not a complete, production-ready application or solution.
This liveProject is for both new and experienced Python programmers who want to improve their understanding of the language. To begin this liveProject you will need to be familiar with:
- Python “shell” such as Jupyter Notebook
- Defining a function
- Defining a class
you will learn
In this liveProject, you’ll master fundamental Python concepts and techniques that will help you grow as a Python programmer.
- Use the __dict__ attribute to look at an instance’s attributes
- Use the dir() function to see all of the attributes an object has
- Use the type() function to both get the class of an object and to create a class