Python: Decorate a Method That Gets Passed the Class Instance
The other day I needed to decorate a method with a decorator class that knows about the owner of the method meaning the instance. This works as expected with function decorators:
print %
return
return
print %
If you need/want to use a class based decorator you have to do this:
=
print %
return
=
=
return
print %
Thanks to Ozgur who's post about the topic pointed me in the right direction.