A = X > Y ? X : Y
Curtis Jensen
cjensen at be-research.ucsd.edu
Wed Feb 9 16:13:09 EST 2000
Fredrik Lundh wrote:
>
> Justin Sheehy <dworkin at ccs.neu.edu> wrote:
> > > 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.
>
> umm. to be precise, he asked for something equivalent to
> "the C command a = x > y ? x : y". I'd say "a = max(x, y)"
> is a pretty good approximation ;-)
>
> (sure, the x and y *names* are both evaluated, but they're
> references, and the corresponding objects are not affected
> in any way...)
>
> </F>
a = max(x,y) is what I was looking for. Thanks. Some days it's just
hard to see the obvious.
--
Curtis Jensen
cjensen at be-research.ucsd.edu
http://www-bioeng.ucsd.edu/~cjensen/
FAX (425) 740-1451
More information about the Python-list
mailing list