On Thu, Oct 20, 2011 at 8:16 PM, Chris Angelico <ros...@gmail.com> wrote: > Hmm. I wonder would slice objects be appropriate? They're comparable: > >>>> a=slice(1,10) >>>> b=slice(1,10) >>>> a==b > True > > They're not iterable though - not directly (but you could slice > range(maxint) down to size). You could possibly use itertools.islice > objects for a similar job, but they're not comparable.
They have completely different semantics for negative numbers. range(-7, 10) and range(maxint)[slice(-7, 10)] are two completely different things. Still, though, if slice objects are directly comparable, I can't see any reason why range objects shouldn't be. Cheers, Ian -- http://mail.python.org/mailman/listinfo/python-list