Sybren Stuvel wrote:
> [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?

I'm looking at various tracebacks now. I don't see any special problems
with lambdas. Inner functions are inadequately identified, so that the
file and line number has to be used, which works just as well as for
lambdas.

> 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.

Which proposed lambda syntax is closest in this sense?

> I can already foresee that I'll have a tougher time explaining your
> lambda-based "decorators", than the current decorators, to people
> learning Python.

Is it unusual to have a tougher time explaining X than Y to people who
are learning a language, where X and Y are different features?

For instance, an assignment statement is easier to explain than a
metaclass. Therefore, assignment statements are probably going to be
covered in an earlier lecture of a Python course than metaclasses.

In what language are features equally easy to explain?

It's possible to use Python while pretending that lambdas don't exist
at all. (That's true of the lambda in its current form, as well as the
proposed forms).

-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to