Multi-line lambda proposal.

yairchu at gmail.com yairchu at gmail.com
Thu May 11 09:48:16 CEST 2006


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




More information about the Python-list mailing list