Ternery operator

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Andrew Chalk

    Ternery operator

    Is there a python equivalent of the C ternery operator?

    I.e.:

    fred = (x == 1) ? 12 : 15

    If not, what's the best way to construct the same logic?

    Regards


  • Peter Hansen

    #2
    Re: Ternery operator

    Andrew Chalk wrote:[color=blue]
    >
    > Is there a python equivalent of the C ternery operator?[/color]

    See http://www.python.org/cgi-bin/faqw.p....16&req=search

    Comment

    Working...