BIG problem if readline strips newlines

Alex Martelli aleaxit at
Tue Jun 12 18:36:49 EDT 2001

"Bjorn Pettersen" <BPettersen at> wrote in message
news:mailman.992379739.20351.python-list at
> >standard python idioms will no longer work...
> >
> >for line in file.readlines(chomp=1):
> >    pass
> Um.  Think again?  Why wouldn't this work?

I think he meant:

  while 1:
    line = file.readline(chomp=1)
    if not line: break

So if you want your lines pre-chomped you have to use
the faster .xreadlines() approach -- doesn't seem a bad
thing to me... incentive towards progress!-)


More information about the Python-list mailing list