Ternery operator

Andrew Chalk achalk at XXXmagnacartasoftware.com
Sun Sep 7 18:53:29 CEST 2003


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






More information about the Python-list mailing list