defAdvanced Playground

Defines a new function or method

Python Playground
Output
Click "Run" to execute your code

Decorators use @syntax to wrap functions. functools.wraps preserves the original function's name and docstring on the wrapper.

Challenge

Try modifying the code above to explore different behaviors. Can you extend the example to handle a new use case?