>> Can new_func reference self? Would self just be one of the args? >> >> -Greg >> > > For methods, self is always "just one of the args". When the > decorator is applied to a method, self will be args[0] in new_func. > If you want to use the name "self" instead of args[0] you can:
def pre(fn):
def new_func(self,*args,**kwargs):
print "hi",self
return fn(self,*args,**kwargs)
return new_func
Best,
Laszlo
--
http://mail.python.org/mailman/listinfo/python-list
