python short conditional?

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Pieter Claassen

    python short conditional?

    I am looking to find a short conditional for python equivalent
    to the perl question mark operator

    statement? if true:else false

    Any recommendations on this?

    Pieter
  • Roy Smith

    #2
    Re: python short conditional?

    Pieter Claassen <pieter@counter snipe.com> wrote:
    [color=blue]
    > I am looking to find a short conditional for python equivalent
    > to the perl question mark operator
    >
    > statement? if true:else false[/color]

    There is no such ternary operator in Python. There was a HUGE debate
    earlier this year about possibly adding it. To make a very long story
    short, it's not going to happen. Look up PEP-308 for more details.

    Comment

    Working...