Terry Reedy writes:
On 9/30/2015 1:28 PM, Chris Barker wrote:
But again, we could add indexing to enumerate, and have it do the ugly inefficient thing when it's using an underlying non-indexable iterator,
If the ugly inefficient thing is to call list(iterable), then that does not work with unbounded iterables.
I think he means
from itertools import islice a = list(islice(iterable, 0, 99))
Or the input iterable might produce inputs at various times in the future.
Horrors! We'll have to add a "block=False" parameter to next(). (We can bikeshed on the default later.)
Seriously, I think that one we just have to live with, just as we already live with it in any context where we access an iterable.