Vidyalelo
Python · Q11

Decorators in Depth

Programming · Python · question 11

Q11

How is a decorator applied to a class method in Python?

A.
By using the @decorator syntax above the class
B.
By using the @decorator syntax above the method
Answer
C.
By applying the decorator within the method
D.
By using the apply_decorator() function

Answer: Option B

Solution

Answer: Option B
Solution:
A decorator is applied to a class method using the @decorator syntax above the method definition.