From: Josh C. <jc...@nc...> - 2009-12-16 16:12:22
|
On Tue, 15 Dec 2009, Nicola Jean wrote: > I was wondering if there is a %feature that allow to decorate a > method. What I want to get is something like: > class MyFirstClass(object): > ... > @mydecorator > def __eq__(self, *args): > return _MyModule.MyFirstClass___eq__(self, *args) > ... > is it possible in swig? You might be able to do this using %feature("shadow"). If that doesn't work you may be able to use %pythoncode within %extend to insert __eq__ = mydecorator(__eq__), which accomplishes the same thing (but on a class-by-class basis). Josh |