"?:", "a and b or c" or "iif"
Robert Meegan
Robert.Meegan at wcom.com
Fri May 28 11:58:49 EDT 1999
On Fri, 28 May 1999, Andrew Clover wrote:
>
> Although that's fine in this case, where the result of the expression is
> assigned to a variable, that doesn't always happen. For example:
>
> selectFlavour(nutAllergy ? strawberry : pistachio)
>
> Would have to be written as:
>
> if nutAllergy:
> flavour= strawberry
> else:
> flavour= pistachio
> selectFlavour(flavour)
>
Actually, I would have written it:
if nutAllergy:
selectFlavour(strawberry)
else:
selectFlavour(pistachio)
without any temporary variables.
To be really precise, I would have spelled it selectFlavor like a proper
English speaker <grin>.
--- Robert
--------------------------------
Robert Meegan
MCIWorldCom - Cedar Rapids, Iowa
319.375.2416
More information about the Python-list
mailing list