June 2017
Beginner to intermediate
274 pages
6h 49m
English
Python includes a few decorators in the global namespace and an expanding list of them in the standard library. The most commonly used global decorator is @staticmethod. It makes the class member function callable through the class, rather than an instance, just like @staticmethod decorators in other languages. The following screenshot illustrates the code example for @staticmethod:

It's also possible to use multiple @ lines before def; with this, multiple decorators will be invoked. The decorator that's closest to def will be called first, and then its return value will be passed to the next closest decorator, ...
Read now
Unlock full access