Op 05-01-16 om 03:16 schreef Robert: > Hi, > > I find an example code on wrap at this link: > http://stackoverflow.com/questions/308999/what-does-functools-wraps-do > > Here is the code: > //////// > def logged(func): > def with_logging(*args, **kwargs): > print func.__name__ + " was called" > return func(*args, **kwargs) > return with_logging > /////// > > I understand now, but I feel the args usage is weird. I don't see any way > to use *args and **kwargs in above code. What is your opinion on it? > > > Thanks,
You want the following to work def add(a, b): return a + b def double(n) return n + n logged_add = logged(add) logged_double = logged(double) s = logged_add(3, 5) d = logged_double(13) -- Antoon Pardon -- https://mail.python.org/mailman/listinfo/python-list