Meaning
The __wrapped__ attribute of a wrapper function created with functools.wraps refers to the original function that was wrapped.
Primary Function
Provides access to the original wrapped function for introspection, debugging, or calling the undecorated version.
Communicative Purpose
Asserts that the wrapper exposes the original function via its __wrapped__ attribute, enabling introspection.
Função primária
Provides access to the original wrapped function for introspection, debugging, or calling the undecorated version.
Propósito comunicativo
Asserts that the wrapper exposes the original function via its __wrapped__ attribute, enabling introspection.
Situações de gatilho
When using functools.wraps to create a decorator and needing to access the original function, e.g., for debugging, calling the undecorated function, or preserving metadata.
Contextos
Writing decorators, debugging decorated functions, preserving function signatures, accessing the original function from a wrapper.
Família do chunk
- functools.wraps
- decorator pattern
Dica de memória
Think of __wrapped__ as the original function tucked inside the wrapper.
Nota
The __wrapped__ attribute is set automatically by functools.wraps to point to the original function.
Log in to save chunks.