A = X > Y ? X : Y

Skip Montanaro skip at mojam.com
Wed Feb 9 11:59:56 EST 2000


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

    Michal> def iif( condition, first, second ):
		...
    Michal> then it's:

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

Wrong semantics.  Both x and y will be evaulated before the function call
regardless of the value of the condition.

Skip Montanaro | http://www.mojam.com/
skip at mojam.com | http://www.musi-cal.com/
"Languages that change by catering to the tastes of non-users tend not to do
so well." - Doug Landauer




More information about the Python-list mailing list