Some "pythonic" suggestions for Python
Hrvoje Niksic
hniksic at xemacs.org
Mon Nov 12 09:54:20 EST 2007
Loic Mahe <loic.mahe at nospam.fr> writes:
> Chris M write :
>> Multi-return value lambda? Just so you know, there is no concept of
>> returning more than one value from a function.
>
> I wrote:
>> * multi return value lambda
>
> I meant: multiple return statement, not return multiple values
>
> pseudo code here:
>
> lambda x: if A return B, if C return D, if E return F ...
You can do that with conditional expressions:
lambda x: B if A else D if C else F in E ...
> it could be nice if ou could write normal functions ... as lambda
> ones and not being limited to a subset of the kewords ...
It becomes natural if you think of lambda as a deferred expression
rather than as an anonymous function.
More information about the Python-list
mailing list