[EMAIL PROTECTED] wrote:

> 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
> 
> 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
> 
> 
One big problem with this is that with the decorator the function has a 
name but with a lambda you have anonymous functions so your tracebacks are 
really going to suck.
-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to