On 7/2/10 11:55 AM, Thomas Jollans wrote: > Looks good! You may still want to use functools.update_wrapper or > functools.wraps on "wrap".
Are you sure? I've been doing a little bit of experimentation and I only did the 'wraps' on that inner function, because it seemed that it was all that was needed to get the propagation of function data I expected. I've since changed it to: def wrapper(fn, *args, **kwargs): print "Calling." result = fn(*args, **kwargs) print "Called." return result return decorator.decorator(wrapper, fn) Because the decorator library includes argspec propagation which was important for other parts of this code which does introspection. (This toy project is, I fully admit, going into very dark and evil places that I have at length advised people against, 'You don't want to do that!'). > PS: if you weren't stuck on 2.5, but were using 3.x, there's all kinds > of fun stuff you could do with function annotations ;-) Oh, believe me, I desperately wish I could go to 3.x. Between function annotations and the new metaclass power (Hi, __prepare__, I love you, please wait for me and I'll marry you when I migrate). I just can't yet. I can't quite figure out why people are all, '3.x brings you nothing'. Yes, the majority of the focus was cleaning, removing edges, but *lord* there's a LOT I am VERY looking forward to using. -- Stephen Hansen ... Also: Ixokai ... Mail: me+list/python (AT) ixokai (DOT) io ... Blog: http://meh.ixokai.io/
signature.asc
Description: OpenPGP digital signature
-- http://mail.python.org/mailman/listinfo/python-list