Shouldn't urlopen "files" be iterable?

Magnus Lie Hetland mlh at idi.ntnu.no
Sat Sep 29 15:37:14 EDT 2001


"Oleg Broytmann" <phd at phd.pp.ru> wrote in message
news:mailman.1001790031.21149.python-list at python.org...
> On Sat, Sep 29, 2001 at 06:48:07PM +0000, Grant Edwards wrote:
> > How do you request part of a file via HTTP?
>
>    Using ranges.

And... I don't see why I would have to... If the file were big enough,
I might break out of my for-loop before the entire file was downloaded.
The "file" might not even be a file... It might be e.g. a cgi-script
spewing lines of information. I wouldn't want to download "all" of these
before iterating over them...

I'm sure xreadlines would work nicely, but then again, why shouldn't I
be able to just iterate over the file? I see no real argument against
including the functionality.

--

  Magnus Lie Hetland         http://www.hetland.org

 "Reality is that which, when you stop believing in
  it, doesn't go away."           -- Philip K. Dick






More information about the Python-list mailing list