Vidyalelo
Python · Q4

Decorators in Depth

Programming · Python · question 4

Q4

How can you pass arguments to a decorator in Python?

A.
By modifying the decorator's code
B.
By using the @decorator syntax
Answer
C.
By defining arguments within the function
D.
By using the args keyword

Answer: Option B

Solution

Answer: Option B
Solution:
Arguments can be passed to decorators using the @decorator(arg) syntax.