One big gotcha when it comes to #Python decorators is that the decorator will covertly replace the function's name and docstring with its own (๐งต๐๐)
Check out the following example
When you run the decorated code in the previous tweet, you will see that the decorated function's name and docstring have disappeared!
You may be wondering, why do I care if a function's name and docstring are replaced?
The reason this is important is that your introspection won't work correctly anymore. If you run Python's `help()` built-in against your decorated function, it will give you the wrong info
If you use Sphinx or another automated documentation builder, it may not grab the correct information and then your docs are bad for decorated functions
Another issue that sometimes occurs when you use decorated functions is that your unittests can get confused and you may end up getting some weird test errors!
Fortunately, Python comes with `functools.wraps()`, which will fix the problem of a decorator obfuscating the function's name and docstring.
This series of tweets is based on one of my article's from @mousevspython