Chris Smith wrote:
> What I really want to do is take four lines of conditional, and put
> them into one, as well as blow off dealing with a 'filler' variable:
>
> return "the answer is " + "yes" if X==0 else "no"
>
>
> Or whatever the final release syntax is.
The syntax is fine, but the semantics might not be what you expected. If I
understand it correctly you need:
return "the answer is " + ("yes" if X==0 else "no")
Guido's pronouncement said:
> In general, 'if' and 'else' bind less tight than everything except
> lambda.
--
http://mail.python.org/mailman/listinfo/python-list