Vidyalelo
Python · Q9

Decorators in Depth

Programming · Python · question 9

Q9

What is the purpose of the functools.wraps() function in decorators?

A.
To create a new function
B.
To modify the decorator's behavior
C.
To preserve the original function's metadata
Answer
D.
To remove a decorator

Answer: Option C

Solution

Answer: Option C
Solution:
functools.wraps() preserves the original function's metadata when using decorators.