-
Book Overview & Buying
-
Table Of Contents
-
Feedback & Rating

Clean Code in Python
By :

With the introduction we've just had, we now know the basics of decorators: what they are, and their syntax and semantics.
Now we're interested in more advanced uses of decorators that will help us structure our code more cleanly.
We'll see that we can use decorators to separate concerns into smaller functions, and reuse code, but in order to so do effectively, we'd like to parametrize the decorators (otherwise, we'd end up repeating code). For this, we'll explore different options on how to pass arguments to decorators.
After that, we can see some examples of good uses of decorators.
At this point, we already regard decorators as a powerful tool in Python. However, they could be even more powerful if we could just pass parameters to them so that their logic is abstracted even more.
There are several ways of implementing decorators that can take arguments, but we will go...