[Python-ideas] Iterating non-newline-separated files should be easier

Chris Angelico rosuav at gmail.com
Sat Jul 19 09:32:53 CEST 2014


On Sat, Jul 19, 2014 at 5:10 PM, Nick Coghlan <ncoghlan at gmail.com> wrote:
> I still favour my proposal there to add a separate "readrecords()"
> method, rather than reusing the line based iteration methods - lines
> and arbitrary records *aren't* the same thing

But they might well be the same thing. Look at all the Unix commands
that usually separate output with \n, but can be told to separate with
\0 instead. If you're reading from something like that, it should be
just as easy to split on \n as on \0.

ChrisA


More information about the Python-ideas mailing list