LearnFrenzy
Sign in Take a free test

Decorators · Decorators MCQ · Question 5

When does the decorator itself run? Answer, explanation & discussion

  • MCQ
  • Medium
  • 0 comments
  • Answer explained
  • Moderated community
Question 5 Back to Exercise

When does the code in a decorator's body (outside the wrapper) run?

  • A Every time the decorated function is called
  • B Only when the program ends
  • C Once, when the decorated function is defined Correct
  • D Never
Correct Answer: Option C

The wrapper's body is what runs on every call.

Discussion & Comments 0

Share your method, a shortcut, or ask about a step you didn't follow.

No comments yet. Be the first to share your solution!

Post your comment

Comments appear after a quick review by our team.

Search LearnFrenzy

Esc

Quick links