function decorator-like function
pmaupin at gmail.com
Sat Mar 27 19:07:47 CET 2010
On Mar 27, 11:24 am, vsoler <vicente.so... at gmail.com> wrote:
> I see what happened. The first line was somehow hidden.
> Thank you very much.
You're welcome. Sorry about the formatting. Also, note that if your
decorator is complicated, you might want to use a class instead of a
nested function. Here's the same thing, using a class (and using the
actual decorator syntax):
def __init__(self, func):
self.func = func
def __call__(self, *args):
def f(a, b):
print a + b
More information about the Python-list