What does functools.wraps do in a decorator?
- A Speeds up the decorated function
- B Copies the original function's name, docstring and metadata onto the wrapper
- C Caches the return value
- D Validates arguments
Answer
Copies the original function's name, docstring and metadata onto the wrapper
Without it the wrapper replaces the original's identity, which breaks introspection, documentation tools and some frameworks.





