(test?return_true:return_false)

Daniel backwardthinker at juno.com
Thu Jan 23 10:35:25 EST 2003


Is there a python equivalent to the (test?return_true:return_false)
function?  It's present in a number of other languages, so I was
hoping there would be something similar.  If test evaluates to true,
then the 1st value is returned.  If false... the 2nd value.

For a dumb example, something to the effect of: print 'Search complete
(%d match%s found)'%(matches,(matches==1?'':'es'))

Thanks,
Daniel




More information about the Python-list mailing list