Peter Otten wrote:
I usually use decorator functions, but I think the following should work,
too:
class deco(object):
def __init__(self, func):
self._func = func
def __call__(self, *args):
print "Decorator:", args
self._func(*args)
def __get__(self, *args):
return deco(self._func.__get__(*args))
This looks like a winner to me. It is elegant, works for functions as
well as for methods, and does not mess with the internals of the
decorator which avoids the problems that Duncan pointed out.
Thanks Peter, and thanks everyone else that chimed in and contributed.
/MiO
--
http://mail.python.org/mailman/listinfo/python-list