2.2 <-> 2.3 surprise
Terry Reedy
tjreedy at udel.edu
Mon May 31 16:14:54 EDT 2004
"Roman Suzi" <rnd at onego.ru> wrote in message
news:Pine.LNX.4.58.0405312107460.3672 at rnd.onego.ru...
>
> Hi!
>
> I really like python 2.3 but sometimes I write for 2.2 too.
>
> New cool feature of doing:
>
> f = open('file')
> for line in f:
> do_something(line)
>
> works strange in 2.2: I can't just quit first loop and do:
>
> for line in f:
> do_some_more(line)
In 2.2, the file iterator read chunks of the file and then fed out lines.
When you quit loop, read but unprocessed stuff got tossed.
tjr
More information about the Python-list
mailing list