A = X > Y ? X : Y

Brad Howes bradh at mediaone.net
Tue Feb 8 20:23:28 EST 2000


Curtis Jensen <cjensen at be-research.ucsd.edu> writes:

> 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

Its in the FAQ -- and its not as pretty:

  a = ( ( x > y ) and x ) or y

Seems to work fine for numbers -- not sure about objects or strings.

Brad

-- 
    "Were people this stupid before TV?" -- _White Noise_ by Don DeLillo



More information about the Python-list mailing list