Login to manage your account

Please enter a valid email address.
Forgot Password?
Please enter a valid password.
OR

Don't have an account yet? Sign up

What does functools.wraps do in a decorator?

  1. A Speeds up the decorated function
  2. B Copies the original function's name, docstring and metadata onto the wrapper
  3. C Caches the return value
  4. 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.

All Python MCQs

Login to manage your account

Please enter a valid email address.
Forgot Password?
Please enter a valid password.
OR

Don't have an account yet? Sign up as