Greg Ewing wrote: > Bill Janssen wrote: > > > Incidentally, what kind of iteration should apply to files opened in > > "binary" mode > > I don't think binary files should directly support > iteration at all. Wrap it in an object that iterates > the way you want. > > for b in readbytes(f): > ... > > for blk in readblocks(f, 1024): > ... > > I'm inclined to think that text files shouldn't be > directly iterable either, and you should use > > for line in readlines(f): > ...
I like both these ideas. So file.readlines() would return an iterable, then? Bill _______________________________________________ Python-3000 mailing list [email protected] http://mail.python.org/mailman/listinfo/python-3000 Unsubscribe: http://mail.python.org/mailman/options/python-3000/archive%40mail-archive.com
