[Python-ideas] TextIOWrapper callable encoding parameter

Victor Stinner victor.stinner at gmail.com
Wed Jun 13 00:13:50 CEST 2012


2012/6/11 Nick Coghlan <ncoghlan at gmail.com>:
> Immediate thought: it seems like it would be easier to offer a way to inject
> data back into a buffered IO object's internal buffer.

BufferedReader has already an useful peek() method to read data
without changing the position.
http://docs.python.org/library/io.html#io.BufferedReader.peek

It's not perfect ("The number of bytes returned may be less or more
than requested.") but better than nothing.

Victor



More information about the Python-ideas mailing list