looping through a file
Steven Taschuk
staschuk at telusplanet.net
Mon Jul 28 16:21:29 EDT 2003
Quoth John J. Lee:
> bokr at oz.net (Bengt Richter) writes:
[woes with file iterators reading ahead]
> > >I gathered from a recent thread that this has changed -- the file is
> > >its own iterator now. Was the old behaviour ever released in 2.2, or
> > >was it just part of a 2.3 beta?
> > >
> > Curious what was changed ...
>
> I'm not certain it has changed -- haven't tested.
2.3 has the change, 2.2.2 does not:
Python 2.2.2 (#1, Jun 19 2003, 11:01:48)
>>> fp = file('foo')
>>> iter(fp) is fp
0
Python 2.3b1 (#1, Apr 30 2003, 22:25:58)
>>> fp = file('foo')
>>> iter(fp) is fp
True
(I don't know about 2.2.3.)
--
Steven Taschuk staschuk at telusplanet.net
"Please don't damage the horticulturalist."
-- _Little Shop of Horrors_ (1960)
More information about the Python-list
mailing list