Python

What functools.wraps restores when you decorate a function

A decorator replaces your function with a wrapper, so its name, docstring, and signature change. Here is exactly what functools.wraps copies back and how it records __wrapped__.

2026-07-30 · 4 min read · 752 words · KbWen · EN