1. Home
  2. Data Science
  3. Python
  4. Which functools helper preserves a wrapped function's name…

Added 25 Nov 2026

Which functools helper preserves a wrapped function's name and docstring in a decorator in Python?

  1. functools.partial
  2. functools.cache
  3. functools.reduce
  4. functools.wraps Correct answer

Correct answer

D. functools.wraps

MCQSEXAM

Explanation

@wraps(func) copies metadata such as __name__ and __doc__ to the wrapper.

Reference

Asked in: Python Interview Advanced Python

https://docs.python.org/3/library/index.html

Preparing for an exam?

Doubts & discussion

Not sure why the answer is D? Ask here and get an explanation.

Ask a doubt about this MCQ

Shown after review. No links please.

More Python MCQs

Practise all Python MCQs

Similar MCQs