[Python-Dev] "and" and "or" operators in Py3.0
Martin Blais
blais at furius.ca
Tue Sep 20 14:41:15 CEST 2005
On 9/19/05, Andrew McNamara <andrewm at object-craft.com.au> wrote:
>
> I agree. I find I often have an object with an optional friendly name
> (label) and a manditory system name. So this sort of thing becomes common:
>
> '%s blah blah' % (foo.label or foo.name)
>
> The if-else-expression alternative works, but isn't quite as readable:
>
> '%s blah blah' % (foo.label ? foo.label : foo.name)
Where does this work?
More information about the Python-Dev
mailing list