[EMAIL PROTECTED] enlightened us with: > this is how I think it should be done with multi-line lambdas: > > def arg_range(inf, sup, f): > return lambda(arg): > if inf <= arg <= sup: > return f(arg) > else: > raise ValueError
This is going to be fun to debug if anything goes wrong. Ever seen such a traceback? > and instead of > @arg_range(5, 17) > def f(arg): > return arg*2 > > you do: > f = arg_range(5, 17, lambda(arg)): > return arg*2 A function decorator is supposed to add something to a function. The syntax that sticks the closest to that of defining a function seems most Pythonic to me. I can already foresee that I'll have a tougher time explaining your lambda-based "decorators", than the current decorators, to people learning Python. Sybren -- The problem with the world is stupidity. Not saying there should be a capital punishment for stupidity, but why don't we just take the safety labels off of everything and let the problem solve itself? Frank Zappa -- http://mail.python.org/mailman/listinfo/python-list