A = X > Y ? X : Y

Michal Wallace sabren at manifestation.com
Wed Feb 9 17:46:26 CET 2000


Curtis Jensen wrote in message <38A0BD01.9586107B at be-research.ucsd.edu>...
>I fear that this question has already been asked, but is there and
>equivalant one line command that is equivalant to the C command:
>
>a = x > y ? x : y



I know there's been a couple replies to this... but why not do something
like
VB's (or at least VBA's - not sure if VB proper has it) "immediate If"
function?

def iif( condition, first, second ):
    result = second
    if condition:
        result = first
    return result

then it's:

a = iif( a > y, x, y )

-michal
http://www.sabren.com/






More information about the Python-list mailing list