[Python-ideas] Iterating non-newline-separated files should be easier
Nick Coghlan
ncoghlan at gmail.com
Sat Jul 19 10:18:35 CEST 2014
More information about the Python-ideas mailing list
Sat Jul 19 10:18:35 CEST 2014
- Previous message: [Python-ideas] Iterating non-newline-separated files should be easier
- Next message: [Python-ideas] Iterating non-newline-separated files should be easier
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
On 19 July 2014 03:32, Chris Angelico <rosuav at gmail.com> wrote: > 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. Python isn't Unix, and Python has never supported \0 as a "line ending". Changing the meaning of existing constructs is fraught with complexity, and should only be done when there is absolutely no alternative. In this case, there's an alternative: a new method, specifically for reading arbitrary records. Cheers, Nick. -- Nick Coghlan | ncoghlan at gmail.com | Brisbane, Australia
- Previous message: [Python-ideas] Iterating non-newline-separated files should be easier
- Next message: [Python-ideas] Iterating non-newline-separated files should be easier
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
More information about the Python-ideas mailing list