lambda functions

Chris Rebert clp2 at rebertia.com
Mon Aug 31 09:51:07 CEST 2009


On Mon, Aug 31, 2009 at 12:41 AM, Pierre<pierre.gaillard at gmail.com> wrote:
> Hello,
>
> I would like to know if it is possible to define a loop in a lambda
> function....

Not possible. Lambdas can only contain a single expression. A loop is
a block statement.
Just use a named function instead. There's nothing that can be done
with a lambda that can't be done with a named function instead.

Cheers,
Chris
--
http://blog.rebertia.com



More information about the Python-list mailing list