>>>>> "Duncan" == Duncan Booth <[EMAIL PROTECTED]> writes:

    Duncan> 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.

    Duncan> The syntax is fine, but the semantics might not be what
    Duncan> you expected. If I understand it correctly you need:

    Duncan> return "the answer is " + ("yes" if X==0 else "no")

    Duncan> Guido's pronouncement said:

    >> In general, 'if' and 'else' bind less tight than everything
    >> except lambda.
I say, with the utmost arrogance, that I won't neglect the parens more
than, say, 50 times. ;)
-Chris
-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to