[Python-Dev] range objects in 3.x

Ethan Furman ethan at stoneleaf.us
Fri Sep 23 20:04:50 CEST 2011


A question came up on StackOverflow about range objects and floating 
point numbers.  I thought about writing an frange that did for floats 
what range does for ints, so started examining the range class.  I 
noticed it has __le__, __lt__, __eq__, __ne__, __ge__, and __gt__ 
methods.  Some experiments show that xrange in 2.x does indeed implement 
those operations, but in 3.x range does not (TypeError: unorderable 
types: range() > range()).

Was this intentional, or should I file a bug report?  (I was unable to 
find anything in the What's New documents; also, I did not test in 3.0, 
just in 2.7, 3.1, 3.2.)

~Ethan~


More information about the Python-Dev mailing list