Friday, July 28, 2017

Python decorators explained in 2 minutes

Python decorators seem to confuse most newbies. But in reality they are just a fancy way of wrapping functions and modifying their behaviour as a consequence. They are functionally similar to Java annotations.

The code below describes a decorator in its simplest form.

It can be rewritten as per below, using the pie syntax:
Post a Comment