Is it possible to create a decorator which is __init __
'D' followed by other arguments For the methods called?
For example: Import from
MyDecorator bar = MyDecorator (debug = true) @ bar.myfunc (a = 100) Def Spam (): pass @ bar .myotherfunc (x = false) DIF Egg (): Pass
If it is is possible, you can work as an example
< / Div>
Of course, a decorator is just a function that accepts the function and returns the function. There is no reason that the function can be an example method (or if you have any arguments, can not be reverted back) it is actually a trivial example (because I'm not sure what you will try to do with it):
, I can not think of a use case above my head. But I'm sure they are there.
Comments
Post a Comment