if does not evaluate

Jim Newton jimka at rdrop.com
Sat Jun 5 20:01:05 EDT 2004


how do you put an if or a for inside a lambda?

The expression i'm suggesting as evaluatable
could be passable to a function call as well,
as being mappable, or usable inside a lambda.
It seems better to me in that it stops being
a special case.

E.g.,

myfun( ( if cond1 expr1: else expr2 ),
        ( if cond2 expr3: else expr4 ))

-jim

>>
>>I.e.,  x = if something:
>>               expr1
>>            else:
>>               expr2
>>
>>parentheses would of course be optional as they are for
>>all expressions.
> 
> 
> You'll first have to convince many people that this is a "problem" to be
> "solved". Why is your solution "better than":
> 
> if something:
>     x = expr1
> else:
>     x = expr2
> 




More information about the Python-list mailing list