How to think about Python decorators (or, everything you never wanted to know about decorators but have been forced to find out anyway)

Function decorators are one of the most powerful features in the Python language, as they provide a succinct way to modify the behaviours of functions – often providing a quick one-liner to endow functions with useful behaviours or properties. However, they can be confusing because (a) the syntax for creating decorators …