Python execution speed
Martin von Loewis
loewis at informatik.hu-berlin.de
Wed Nov 21 09:39:44 EST 2001
"Morten W. Petersen" <morten at thingamy.net> writes:
> In Python, there is:
>
> def multiply(argument):
> return argument * argument
>
> Or (using anonymous functions):
>
> multiply = lambda argument: argument * argument
>
> Where the lambda has the implicit return-of-last-expression (no return
> needed), while functions do not.
It is really a little different. In lambdas, there is only a single
expression, and that is the result. Functions, OTOH, are sequences of
statements, not of expressions.
Regards,
Martin
More information about the Python-list
mailing list