🎙 Free live masterclass · Sun, 29 Nov, 7:00 pm IST · Java Full Stack roadmap Register free →
Skills101
← Quiz: Python Decorators: all 10 questions

Quiz: Python Decorators · Question 6 of 10

What does @functools.wraps(func) do?

What does @functools.wraps(func) do?

  1. A.Copies the original function's name, docstring and other details onto the wrapper
  2. B.Caches the function's results
  3. C.Prevents the function from being decorated twice
  4. D.Makes the wrapper run before the function
Answer & explanation

Correct answer: Copies the original function's name, docstring and other details onto the wrapper

Without it, the decorated function reports the wrapper's name.

Can you get the rest right without peeking?

Take the timed Quiz: Python Decorators quiz free. Pass it to earn XP and count towards your certificate.

Start the quiz →