FUNCTIONS IN PYTHON: ADVANCED > MISSION 4 > PYTHON DECORATORS

Decorators: Advanced

In the previous lesson, we learned a lot about how Python decorators work and how they make use of several Python concepts to work including closures, and the scope of a function. To further our knowledge of Python function techniques, we'll learn more about decorators as we work with real-world decorators and learn how to write decorators that take arguments.

In the final lesson of our Python Advanced Functions course, we'll learn more about Python decorators so you can start to recognize common decorator patterns. You'll also look at some decorators that take multiple arguments. By the end of this mission, you'll be able to explain what decorators are, how they work, how to use them, and how to write decorators of your own.

Most importantly, you will know why they work the way they do.

As you learn about Python decorators and how to use them, you’ll get to apply what you’ve learned from within your browser so that there's no need to use your own machine to do the exercises. The Python environment inside of this course includes answer checking so you can ensure that you've fully mastered each concept before learning the next concept.

Objectives

  • Learn how to write decorators that take arguments.
  • Learn how to make sure your decorated functions maintain their metadata.
  • Work with real world decorators.

Mission Outline

1. Introduction
2. Real World Decorators
3. Preserving Metadata When Decorating Functions
4. Preserving Metadata When Decorating Functions Continued
5. Adding Arguments to Decorators
6. Adding Arguments to Decorators Continued
7. Real World Decorators with Arguments
8. Real World Decorators with Arguments Continued
9. Next Steps
10. Takeaways

Course Info:

Intermediate

The median completion time for this course is 6 hours. View Details

This course requires a premium subscription. This course includes four missions.  It is the 27th course in the Data Scientist in Python path.

START LEARNING FREE

Take a Look Inside