
Oct. 12, 2011
4:50 p.m.
On Wed, 2011-10-12 at 17:31 +0100, Sven Marnach wrote:
There are circumstances, for example in unit testing, when it might be useful to check if two range objects describe the same range. Currently, this can't be done using the '==' operator:
>>> range(5) == range(5) False
Would comparing the repr of each one work?
r1 = range(5) r2 = range(5) r1 == r2 False repr(r1), repr(r2) ('range(0, 5)', 'range(0, 5)') repr(r1) == repr(r2) True
Cheers, Ron