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.


  • 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:


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.


Take a Look Inside

(function(d) { d.addEventListener("DOMContentLoaded", function() { var pathname = d.location.pathname.replace(/^[/]|[/]$/g, "").replace("/", "-"); var tags = d.getElementsByTagName("iframe"); var type = pathname.startsWith("course") ? "?course=" : pathname.startsWith("path") ? "?path=" : null; if (type) { var i; for (i = 0; i < tags.length; i++) { if (tags[i].src.indexOf("signup#iframe") !== -1) { tags[i].src = tags[i].src.replace("#iframe", "") + type + pathname + "#iframe"; } } } }, false); })(document);