Some Python 2.1 ideas

Greg Jorgensen gregj at pobox.com
Mon Dec 25 11:02:37 CET 2000


"Bjorn Pettersen" <pbjorn at uswest.net> wrote:
> This would be a good idea, except it wouldn't fit with the standard Python
idiom
> for reading files:
>
>    while 1:
>       line = f.readline_chomp()
>       if not line: break # would always break

Oops! That shows how far I thought my idea through! And me always talking
about idioms...

I always use rstrip because I never care about trailing whitespace. If I did
have a reason to preserve trailing spaces I would write my own code to strip
the trailing newlines.

--
Greg Jorgensen
Deschooling Society
Portland, Oregon, USA
gregj at pobox.com





More information about the Python-list mailing list