Vidyalelo
Python · Q20

Decorators in Depth

Programming · Python · question 20

Q20

What is the purpose of the functools.partial function in decorators?

A.
To create a partial function
Answer
B.
To replace built-in functions
C.
To preserve the original function's metadata
D.
To modify the decorator's behavior

Answer: Option A

Solution

Answer: Option A
Solution:
The functools.partial function is used to create a new function with some arguments pre-filled.