how to overload operator "< <" (a < x < b)?

Scott David Daniels Scott.Daniels at Acm.Org
Fri Aug 7 11:04:22 EDT 2009


Benjamin Kaplan wrote:
> .... Python does not support compound
> comparisons like that. You have to do "a > b and b > c".

Funny, my python does.  This has been around a long time.
I am not certain whether 1.5.2 did it, but "chained comparisons"
have been around for a long time.

     >>> 'a'< 'd' <'z'
     True
     >>> 'a'< 'D' <'z'
     False

--Scott David Daniels
Scott.Daniels at Acm.Org



More information about the Python-list mailing list