stdio EOF ?
Erik Max Francis
max at alcyone.com
Fri Aug 9 17:38:21 EDT 2002
François Pinard wrote:
> [Erik Max Francis]
>
> > The standard idiom [...] is:
>
> > while 1:
> > line = file.readline()
> > if not line:
> > break
> > ...
>
> This is the _old_ standard idiom. 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. It is equivalent to
for line in file.xreadlines(): ...
which has the same buffering problem that the original poster was trying
to avoid.
--
Erik Max Francis / max at alcyone.com / http://www.alcyone.com/max/
__ San Jose, CA, US / 37 20 N 121 53 W / ICQ16063900 / &tSftDotIotE
/ \ There is nothing so subject to the inconstancy of fortune as war.
\__/ Miguel de Cervantes
Church / http://www.alcyone.com/pyos/church/
A lambda calculus explorer in Python.
More information about the Python-list
mailing list