Guido van Rossum wrote: > On 7/9/07, Raymond Hettinger <[EMAIL PROTECTED]> wrote: >> Also, as a practical matter, I think it is a bad idea to introduce >> __getitem__ style access to itertools because the starting point >> moves with each consecutive access: >> >> # access items 0, 2, 5, 9, 14, 20, ... >> for i in range(10): >> print getitem(iterable, i) >> >> Worse, this behavior changes depending on whether the iterable >> is re-iterable (a string would yield consecutive items while a >> generator would skip around as shown above). >> >> Besides being a bug factory, I think the getitem proposal would >> tend to steer people down the wrong road, away from more >> natural solutions to problems involving iterators. A basic step >> in learning the language is to differentiate between sequences >> and general iterators -- we should not conflate the two. > > But doesn't the very same argument also apply against islice(), which > you just offered as an alternative?
Exactly. > PS. If Walter is also at EuroPython, maybe you two could discuss this in > person? Sorry, I won't be at EuroPython. Servus, Walter _______________________________________________ Python-Dev mailing list Python-Dev@python.org http://mail.python.org/mailman/listinfo/python-dev Unsubscribe: http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com