At 07:29 AM 11/5/03 -0500, Raymond Hettinger wrote: >Not really. When you go to write the code, it becomes clear that it >doesn't apply to enumerate or the other itertools. The issue is that >the iterator object holds only the result of iter(iterable) and is in no >position to re-probe the underlying iterable to see if it supports >reverse iteration. The iterator object has no way of knowing in advance >that it is going to be called by reversed(). Why not change enumerate() to return an iterable, rather than an iterator? Then its __reversed__ method could attempt to delegate to the underlying iterable. Is it likely that anyone relies on enumerate() being an iterator, rather than an iterable?
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4