A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://mail.python.org/pipermail/python-dev/2005-September/056595.html below:

[Python-Dev] bool(iter([])) changed between 2.3 and 2.4

[Python-Dev] bool(iter([])) changed between 2.3 and 2.4 [Python-Dev] bool(iter([])) changed between 2.3 and 2.4Guido van Rossum guido at python.org
Wed Sep 21 02:11:35 CEST 2005
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/)
More information about the Python-Dev mailing list

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