stdio EOF ?
pinard at iro.umontreal.ca
Sat Aug 10 00:06:58 CEST 2002
[Erik Max Francis]
> > The new standard idiom is:
> > for line in file:
> > ...
> Correct me if I'm wrong (and this is at least true in 2.2), this does
> not do what the original poster asked.
I did not read the thread. I merely replied to the message saying that:
> > > The standard idiom [...] is:
> > > while 1:
> > > line = file.readline()
> > > if not line:
> > > break
> > > ...
You also write:
> It is equivalent to "for line in file.xreadlines(): ..." which has the
> same buffering problem that the original poster was trying to avoid.
As long as you keep to a single "for line in file.xreadlines():" or
"for line in file:", is there a problem associated with the buffering?
I'm merely curious, here...
François Pinard http://www.iro.umontreal.ca/~pinard
More information about the Python-list