Using descriptors to wrap methods
Sean Ross
sross at connectmail.carleton.ca
Mon Apr 26 08:43:47 EDT 2004
"Edward C. Jones" <edcjones at erols.com> wrote in message
news:408cfa5a$0$28920$61fed72c at news.rcn.com...
> Here is a stripped-down version of a Python Cookbook recipe. Is there a
> simpler, more Pythonical, natural way of doing this?
>
def wrap(f):
def wrapped(*args, **kwds):
print 'pre'
result = f(*args, **kwds)
print 'post'
return result
return wrapped
More information about the Python-list
mailing list