Ternary Operator in Python
John Roth
newsgroups at jhrothjr.com
Fri Apr 1 08:37:35 EST 2005
"praba kar" <prabapython at yahoo.co.in> wrote in message
news:mailman.1172.1112340286.1799.python-list at python.org...
> Dear All,
> I am new to Python. I want to know how to
> work with ternary operator in Python. I cannot
> find any ternary operator in Python. So Kindly
> clear my doubt regarding this
There isn't one, and there won't be one unless Guido
changes his mind, and that's quite unlikely.
There are a number of workarounds; the most
used one seems to be based on a feature of the
'and' and 'or' operators. I believe Pep 308 has
a summary of the different ways you can do it,
and the advantages and drawbacks of each.
John Roth
>
>
>
> __________________________________
> Yahoo! Messenger
> Show us what our next emoticon should look like. Join the fun.
> http://www.advision.webevents.yahoo.com/emoticontest
More information about the Python-list
mailing list