Hairy Sun

Matt's Blog on Some Geeky Topics

Learning Python Decorators Cheatsheet

Decorators are useful in Python for a variety of reasons. Some common uses are:

  • caching
  • logging
  • timing
  • authorization
  • and lots more …

I mentioned in my recent SCALE10x talk that I would have a handout/cheatsheet for Python decorators. Here is a pdf version of the Decorator cheatsheet. It has templates for normal decorators and parameterized decorators. Enjoy!

edit — I apologize for the typos uploaded previously. I ran the handout through doctest and it should be good to go now.

Comments