Summary#
Well done making it this far! After going through this section, you should know that
a decorator is defined by its usage pattern: it adds useful features to a function without modifying a function;
decorators allow writing reusable code because they implement features that are orthogonal to the functions they’ll be applied to;
the at sign
@can be used to apply a decorator to a function at definition time; andthe decorator syntax is just nice syntactic sugar for calling the decorator with another function as an argument and then reassigning it to the same name.
Now that you’ve written some decorators and you’re more comfortable with their syntax, you will learn how to write decorators that are more broadly useful.
If you have any feedback, reach out to me at rodrigo@mathspp.com.