On 9/20/05, Terry Reedy <tjreedy at udel.edu> wrote: > I presume there were two reasons: internal efficiency of preallocations > (list(some_it) for example) This could have been implemented without making the implementation details public. > and letting people differentiate iterator with > something left to return versus nothing, just as we can differentiate > collections with something versus nothing. But this is against the very idea of the iterator protocol -- for general iterators, there may be no way to determine whether there is a next item without actually producing the item, so the proper approach is to code with that in mind. When this type of look-ahead is required, a buffering iterator should be inserted, so that the algorithm can work with all iterators rather than only with iterators over built-in containers. -- --Guido van Rossum (home page: http://www.python.org/~guido/)
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