Martin Panter added the comment:
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.
----------
_______________________________________
Python tracker <[email protected]>
<http://bugs.python.org/issue12053>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe:
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com