background preloader

Python decorators

Facebook Twitter

Python Decorators Don't Have to be (that) Scary. Decorators modify functions.

Python Decorators Don't Have to be (that) Scary

Beginning with the basics, learn how to use decorators in a variety of ways. Execute code when a function is parsed or called. Conditionally call functions and transform inputs and outputs. Write customizable decorators that accept arbitrary arguments. And, if necessary, easily make sure your decorated function has the same signature as the original. What is the Python equivalent of static variables inside a function.

Static class variables in Python.