the PHP ternary operator equivalent on Python

Daniel Crespo dcrespo at gmail.com
Fri Nov 18 14:44:27 EST 2005


Oh... Well, thanks for that information.

I'll do this then:

def TernaryOperation(condition,true_part,false_part):
    if condition:
        return True-part
    else:
        return False-part

a = {'Huge': TernaryOperation(quantity>90,True,False)}

Thank you




More information about the Python-list mailing list