On 9/20/05, Terry Reedy <[EMAIL PROTECTED]> 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/) _______________________________________________ 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