This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author jcon
Recipients benjamin.peterson, jcon, pitrou, stutzbach, vstinner
Date 2011-05-10.19:37:24
SpamBayes Score 3.941054e-09
Marked as misclassified No
Message-id <1305056245.15.0.0737815347229.issue12053@psf.upfronthosting.co.za>
In-reply-to
Content
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))
History
Date User Action Args
2011-05-10 19:37:25jconsetrecipients: + jcon, pitrou, vstinner, benjamin.peterson, stutzbach
2011-05-10 19:37:25jconsetmessageid: <1305056245.15.0.0737815347229.issue12053@psf.upfronthosting.co.za>
2011-05-10 19:37:24jconlinkissue12053 messages
2011-05-10 19:37:24jconcreate