A decorator is a callable that takes a function and returns a replacement callable. Parameterized decorators add one outer factory layer returning the decorator. Without @functools.wraps(fn), the wrapper replaces __name__, __doc__, and __signature__, which breaks FastAPI route introspection, OpenAPI docs, and pytest fixtures.
Follow-up Interview Question · In what order do stacked decorators (@a above @b) execute at definition vs call time?