Vidyalelo
Python · Q10

Decorators in Depth

Programming · Python · question 10

Q10

What is the difference between a class-based decorator and a function-based decorator?

A.
Class-based decorators use fewer resources
B.
Class-based decorators can't accept arguments
C.
Function-based decorators are more flexible
Answer
D.
Function-based decorators are slower

Answer: Option C

Solution

Answer: Option C
Solution:
Function-based decorators are generally more flexible and can accept arguments more easily than class-based decorators.