Decorator Arguments Template

When developing decorators in Python, the first positive thing that stands out is that they can be implemented as “normal Python code”. After some initial research and some practice with closures first successes can be reported, but in the long run one would like to have a class-based solution, especially since there is the concept of callable objects for processing parameterized functions. However, the different call structures for decorators with and without parameters make an extended consideration of the problem necessary.

So the goal is to create a simple Python template that allows equal treatment of decorators with and without parameters as a class-based solution. Following five steps first define the design goals and then translate them into a Decorator Arguments Template.

Using this Decorator Arguments Template, some “classic design patterns” are implemented as decorators and bundled in the decoratory package.


◄ prev

up

next ►

Legal Notice

Privacy Policy

Cookie Consent

Sphinx 7.2.6 & Alabaster 0.7.12

© Copyright 2020-, Martin Abel, eVation. All Rights Reserved.