On Sat, May 2, 2015 at 5:51 PM, Terry Reedy <tjre...@udel.edu> wrote: > On 5/2/2015 5:31 PM, Ian Kelly wrote: > >> Would it have been better if range() had been implemented as xrange() >> from the beginning? Sure, that would have been great. Except for one >> small detail: the iterator protocol didn't exist back then. > > > For loops originally used the getitem iterator protocol. xrange objects have > a __getitem__ method, but not __iter__ or __next__. As Mark pointed out, > they were introduced in 1993.
I'm aware of getitem iterators; just didn't realize that xrange used it or was that old. -- https://mail.python.org/mailman/listinfo/python-list