"Kay Schluehr" <[EMAIL PROTECTED]> wrote in message 
news:[EMAIL PROTECTED]
> Mandus schrieb:
>> You can do stuff like this: lambda x: x and 2 or 3

This is limited by the requirement (often met) that bool(true-branch) == 
True

> You can also do this
>
>   lambda x: {True:2,False:3}.get(bool(a))

This is limited by the requirement that both branches be computable 
regardless of the value of the condition.

> which is both beautiful and pythonic.

Beauty is in the eye of the beholder.  It seems that relative pythonicity 
sometimes is also ;-).

Terry J. Reedy



-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to