A = X > Y ? X : Y

Justin Sheehy dworkin at ccs.neu.edu
Wed Feb 9 13:02:14 EST 2000

"Stidolph, David" <stidolph at origin.ea.com> writes:

> Why not just use the max method?
> a = max(x,y)

Well, the original poster's question was for something equivalent to
their use of C's ?: ternary operator.  max() is not equivalent to that.

I have never personally seen a situation where I thought that an
expression like (x > y and [x] or [y])[0] was really needed or even a
good idea in a Python program.



More information about the Python-list mailing list