if does not evaluate
Jim Newton
jimka at rdrop.com
Mon Jun 7 16:17:56 EDT 2004
well, i accept the fact that python offers some simple
concepts and you do a lot with simple concepts, but why
can't you put an if inside a lambda? if "if" were evaluatable
then you would be able to do that. it seems to me.
lambda seem to work for very simple things but not for
anything substantial.
Terry Reedy wrote:
> "Jim Newton" <jimka at rdrop.com> wrote in message
> news:2if8daFmdreiU1 at uni-berlin.de...
>
>>how do you put an if or a for inside a lambda?
>
>
> By wrapping them in other functions; otherwise you don't.
>
> lambda *args: expr #abbreviates (minus the function name)
> def f(*args): return expr
>
> If your function is more complicated than that, don't try to abbreviate.
> Use def.
>
> Terry J. Reedy
>
>
>
>
More information about the Python-list
mailing list