Search the courses, subjects, tracks, games and features, or jump straight to a page.
2 cards from this section. Quick, good the night before a test.
What is a decorator in Python?
Think about what decorators can do to functions.
Explain how to use the @ syntax for decorators.
Look for the example in the session.
What does a decorator do?
Think about the primary function of a decorator.
True or False: A decorator can be applied to both functions and methods in Python.
Consider the definition of decorators.
Design a decorator that measures the execution time of a function.
Use the time module to calculate elapsed time.
Implement a parameterized decorator that accepts a message and logs it along with function execution.
Think of how to capture an argument for the decorator.
5 more questions in this section. Enroll free to practise them all.
Enroll free