With generators in the language, should xrange be deprecated?
Skip
No, but maybe xrange() should be changed to return an iterator. E.g. something like this:
def xrange(start, stop, step): while start < stop: yield start start += stop
but with the appropriate defaults, and reversal of the test if step < 0, and an error if step == 0, and type checks enforcing ints (or long ints!), and implemented in C. :-)
Although xrange() objects currently support some sequence algebra, that is mostly bogus and I don't think anyone in their right mind uses it. I _was_ using xrange as sets representing (potentially large) ranges of ints. Example:
positive = xrange(1, sys.maxint) if num in positive: ... I didt follow the iterators discussion: would this continue to work? Thomas