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/056675.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
Thu Sep 22 17:23:19 CEST 2005
On 9/22/05, Jim Jewett <jimjjewett at gmail.com> wrote:
> "Is there anything left?" is a pretty analogy for iterators,

But unmaintainable for iterators in general. This was considered ad
nauseam when iterators were initially introduced, and it was an
explicit decision *not* to provide an API to look ahead.

We should *not* give people a way to start coding like this:

  while it:
      x = it.next()
      ...process x...

when they should be writing this instead:

  for x in it:
      ...process x...

How would you implement the "is there anything left" functionality if
the iterator is in fact a generator? (I know, the answer is buffering.
But that has problems too. It was all considered when we designed it.)

--
--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