On Jun 25, 1:52 pm, [EMAIL PROTECTED] wrote: >Try: > > def append(method,bottom): > def wrapped(*args, **kwargs): > res = method(*args, **kwargs) > return bottom(res,*args, **kwargs) > wrapped.__name__ = method.__name__ > setattr(method.im_class,method.__name__,wrapped) > > def prepend(method,top): > def wrapped(*args, **kwargs): > top(*args, **kwargs) > return method(*args, **kwargs) > wrapped.__name__ = method.__name__ > setattr(method.im_class,method.__name__,wrapped)
If you are using Python 2.5, consider functools.update_wrapper, which also sets __module__, __doc__ and other attributes. -- http://mail.python.org/mailman/listinfo/python-list