Functional Functions
functools.update_wrapper()
Copy selected metadata from a wrapped callable to its wrapper and set __wrapped__. It changes metadata, not the actual calling convention.
Formal Syntax & Structure
python syntaxpython
functools.update_wrapper(wrapper, wrapped, assigned=WRAPPER_ASSIGNMENTS, updated=WRAPPER_UPDATES)Parameters & Attributes
| Name | Type | Description |
|---|---|---|
| wrapper | callable | Wrapper receiving metadata. |
| wrapped | callable | Original callable whose metadata is copied. |
| assigned | tuple[str, ...] | Attribute names to assign from the wrapped object. |
| updated | tuple[str, ...] | Attribute names whose mappings are updated. |
Return Value
callable
The callable result described above.
Working Example
Example Snippetpython
import functoolsdef original(x): return xdef wrapper(*args): return original(*args)functools.update_wrapper(wrapper,original)print((wrapper.__name__,wrapper.__wrapped__ is original))