O'Reilly logo
  • Chris Kang thinks this is interesting:

Decorating a function f with @announce causes a line announcing the call to be printed before each call to f. Thanks to the functools.wraps(f) decorator, the wrapper function adopts the name and docstring of the wrapped one, which is useful, for example, when calling the built-in help on such a decorated function.

From

Cover of Python in a Nutshell, 3rd Edition

Note

@announce def someFunction(): print()

f = someFunction()

Due to how def announce() uses @functiontools.wrap, calling someFunction() will call wrap() then someFunction(). someFunction() is called inside wrap().