New submission from John O'Connor <tehj...@gmail.com>: A prefetch() method for Buffered IO may greatly assist 3rd party buffering among other gains. If nothing else, it is worth experimenting with.
Discussion on the topic is here: http://mail.python.org/pipermail/python-ideas/2010-September/008180.html A summary of the method proposed (by Antoine Pitrou): prefetch(self, buffer, skip, minread) Skip `skip` bytes from the stream. Then, try to read at least `minread` bytes and write them into `buffer`. The file pointer is advanced by at most `skip + minread`, or less if the end of file was reached. The total number of bytes written in `buffer` is returned, which can be more than `minread` if additional bytes could be prefetched (but, of course, cannot be more than `len(buffer)`). Arguments: - `buffer`: a writable buffer (e.g. bytearray) - `skip`: number of bytes to skip (must be >= 0) - `minread`: number of bytes to read (must be >= 0 and <= len(buffer)) ---------- components: IO messages: 135731 nosy: benjamin.peterson, haypo, jcon, pitrou, stutzbach priority: normal severity: normal status: open title: Add prefetch() for Buffered IO (experiment) type: feature request versions: Python 3.3, Python 3.4 _______________________________________ Python tracker <rep...@bugs.python.org> <http://bugs.python.org/issue12053> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com