Python: Decorators
55mIntermediate2020-07-07
Authors

Jonathan Fernandes
Consultant focusing on data science, AI, and big data
Course details
Decorators are an increasingly important feature in Python. They add functionality to an existing object without permanently modifying it. Being able to use decorators effectively is critical to working with larger Python projects and frameworks. In this course, Jonathan Fernandes explains what decorators are and why they are used so extensively in production projects. He explains how to solve common challenges associated with decorators, such as debugging; how to chain decorators; how to use decorators with classes; and how to access the arguments passed into decorated functions. Plus, find out how to use and debug decorators in the real world by examining decorators' role in the source code for the Flask microplatform.
Topics include:
Working with functions in Python
Beautifying output
HTML styling
Using decorators with arguments
Using decorators with classes
Identifying decorators in Flask source code
Topics include:
Working with functions in Python
Beautifying output
HTML styling
Using decorators with arguments
Using decorators with classes
Identifying decorators in Flask source code
Skills covered
PythonProgramming LanguagesOpen SourceSoftware DevelopmentDeep Dive (X:Y)
Concepts
0. Introduction
- 01 - Decorators in Python
1. Functions
- 02 - Working with functions in Python
- 03 - Functions within functions
2. Getting Started
- 04 - What are decorators
- 05 - Challenge - Beautify your output
- 06 - Solution - Beautify your output
- 07 - Challenges with debugging
- 08 - Challenge - HTML styling with decorators
- 09 - Solution - HTML styling with decorators
3. Decorators with Arguments
- 10 - Functions with args and kwargs
- 11 - Decorators with args and kwargs
- 12 - Use decorators to time functions
- 13 - Challenge - Decorators with arguments
- 14 - Solution - Decorators with arguments
4. Decorators with Classes
- 15 - Classes and decorators in Python
- 16 - Use decorators as a cache
5. Decorators in the Real World
- 17 - Install Flask
- 18 - Run Flask
- 19 - The route function in Flask
Conclusion
- 20 - Experiment with decorators in Python
Related courses
- Introduction to Model Context Protocol by Anthropic
- Programming Foundations: Design Patterns
- Python: Advanced Design Patterns (2018)
- Python NAPALM Network Automation
- Python Network Programmability: Scaling Scripts
- Python Essential Training
- Python: Working with Files
- Python Statistics Essential Training (2018)