Ternary Operator in Python

Robert Kern rkern at ucsd.edu
Fri Apr 1 22:37:30 EST 2005


Sunnan wrote:
> Terry Reedy wrote:
> 
>> Gee, what about 0.0 < a < 1.0 < b < 2.0?  I see both as synthesized 
>> multinary operators, but your are right in that this combination does 
>> act differently than a+b+c.
> 
> 
> Is < really multinary in python? It looks binary to me, just like +.
> 
> (a+b)+c
> 
> (((0.0 < a) < 1.0) < b ) < 2.0

Go on. Try it with a bunch of different values.

-- 
Robert Kern
rkern at ucsd.edu

"In the fields of hell where the grass grows high
  Are the graves of dreams allowed to die."
   -- Richard Harter



More information about the Python-list mailing list