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/2002-July/026639.html below:

[Python-Dev] Single- vs. Multi-pass iterability

[Python-Dev] Single- vs. Multi-pass iterabilityGordon McMillan gmcm@hypernet.com
Wed, 17 Jul 2002 12:49:44 -0400
On 17 Jul 2002 at 11:27, Andrew Koenig wrote:

> How about a class that represents a file?  If you
> ask it for a single iterator, that's easy.  If you
> ask it for a multiple iterator, it checks whether
> the file is really an interactive device such as a
> pipe or a keyboard. If so, it uses a buffering
> mechanism to simulate multiple iteration; otherwise,
> it lets the multiple iterators access the file
> directly. 
> 
> Then when you ask to iterate over the file, you
> automatically get the least cumbersome mechanism
> needed to support the kind of iteration that you
> requested. 

OK, it's a pipe, and one iterator wants to go past
what's been received. Is that iterator at EOF? Not
really, just "temporary EOF". So should it block?
But I'm single threaded and receiving asynchronously.
Oh, and it turns out to be a humongous download,
and what happens if the buffering mechanism runs
out of memory / disk space. Does my process die?

Aargh. Too much magic. Too many corner cases.

-- Gordon
http://www.mcmillan-inc.com/





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