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 martin.panter
Recipients benjamin.peterson, jcon, martin.panter, nadeem.vawda, pitrou, serhiy.storchaka, stutzbach, vstinner
Date 2015-04-08.03:34:20
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1428464060.98.0.57196964756.issue12053@psf.upfronthosting.co.za>
In-reply-to
Content
Sounds like this might be more appropriate for the BufferedReader and related classes, and less so for the writer and abstract base class.

The proposed API seems strange to me. Is there an illustration of how it might be used? I suspect it wouldn’t be all that useful, and could more or less be implemented with the existing methods:

def prefetch(buffered_reader, buffer, skip, minread):
    buffered_reader.read(skip)
    consumed = buffered_reader.readinto(buffer[:minread])
    if consumed < minread:
        return consumed
    spare = len(buffer) - consumed
    extra = buffered_reader.peek(spare)[:spare]
    total = consumed + len(extra)
    buffer[consumed:total] = extra
    return total

Maybe it would be better to focus on clarifying or redefining the existing peek() method (Issue 5811), rather than making a brand new do-everything method which only seems to do what the other methods already do.
History
Date User Action Args
2015-04-08 03:34:21martin.pantersetrecipients: + martin.panter, pitrou, vstinner, nadeem.vawda, benjamin.peterson, stutzbach, jcon, serhiy.storchaka
2015-04-08 03:34:20martin.pantersetmessageid: <1428464060.98.0.57196964756.issue12053@psf.upfronthosting.co.za>
2015-04-08 03:34:20martin.panterlinkissue12053 messages
2015-04-08 03:34:20martin.pantercreate