[Python-3000] revamping the io stack, part 2 (original) (raw)

Terry Reedy tjreedy at udel.edu
Sun Apr 30 05:42:04 CEST 2006


"Brett Cannon" <brett at python.org> wrote in message news:bbaeab100604291350u6ef6f630je67bf9cc2cc7f465 at mail.gmail.com...

See, this is what I am worried about. I really like not having to figure out what I need to do to read by lines from a file. If the FileStream object had an iter that did the proper wrapping with LinedBufferedStream, then great, I'm happy. But if we do not add some reasonable convenience functions or iterators, this is going to feel rather heavy-handed rather quickly.

Perhaps open() could take a parameter to specify the iteraton chunk: bytes, chars, words, lines, para(graph)s, blocks of size n, splits on string s. I think it somewhat common that an outer line loop contains an inner loop for the true iteration chunk (most often, bytes or the result of split()). The double loop is only there because that is what is easier.

Terry Jan Reedy



More information about the Python-3000 mailing list