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

Andrew Barnert abarnert at yahoo.com
Mon Jul 21 02:41:32 CEST 2014


On Saturday, July 19, 2014 10:00 PM, Nick Coghlan <ncoghlan at gmail.com> wrote:

> That's one of the
> things the PEP process is for - to explain such use cases to folks
> that haven't personally encountered them, and then explain why the
> proposed solution addresses the use case in a way that makes sense for
> the domains where the use case arises.

OK, I wrote up a draft PEP, and attached it to the bug (if that's not a good thing to do, apologies); you can find it at http://bugs.python.org/file36008/pep-newline.txt

It's probably a lot more detailed than necessary in many areas, but I figured it was better to include too much than to leave things ambiguous; after I know which parts are not contentious, I can strip it down in the next revision.

Meanwhile, while writing it, and re-reading Guido's replies in this thread, I decided to come back to the alternative idea of exposing text files' buffers just like binary files' buffers. If done properly, that would make it much easier (still not trivial, but much easier) for users to just implement the readrecord functionality on their own, or for someone to package it up on PyPI. And I don't think the idea is as radical as it sounded at first, so I don't want it to be dismissed out of hand. So, also see http://bugs.python.org/file36009/pep-peek.txt

Finally, writing this up made me recognize a couple of minor problems with the patch I'd been writing, and I don't think I have time to clean it up and write relevant tests now, so I might not be able to upload a useful patch until next weekend. Hopefully people can still discuss the PEP without a patch to play with.


More information about the Python-ideas mailing list