"Xavier Décoret" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
> Hi,
>
> I cannot find the way to do generic lambda functions using the lambda
> syntax in python. I am probably missing a point.
Thinking of lambda args: expression
as more or less abbreviating def <lambda>(args): return expression
should fill you in.
Two differences:
1. the first is an expression and can be used as such within other
expressions;
the second a statement that stands alone.
2. the first will compile (with proper substitutions for 'args' and
'expression');
the second will not, because '<lambda>' is not a legal name.
However, in CPython, '<lambda>' *is* the .func_name attribute of
lambda-defined functions (so they are not quite anonymous;-).
Terry J. Reedy
--
http://mail.python.org/mailman/listinfo/python-list