Summary

Summary#

Well done making it this far! After going through this section, you should know that

  • decorators can be written as classes, for easier management of related data as attributes and implementation of extra behaviour as methods;

  • the dunder method __call__ in class-based decorators mimics the wrapper function of function-based decorators;

  • class-based decorators are great when your decorator does a lot;

  • function-based decorators are better for simpler decorators; and

  • decorator functions and class wrappers can be mixed.


If you have any feedback, reach out to me at rodrigo@mathspp.com.