Message198075
There are some classes in gzip, bz2, lzma, and zipfile modules which implement buffered reader interface. They read chunks of data from underlied file object, decompress it, save in internal buffer, and provide common methods to read from this buffer. Maintaining of duplicated code is cumbersome and error prone. Proposed preliminary patch moves common code into new private class _io2._BufferedReaderMixin. If the proposition will be accepted in general, I'm going to write C version and move it into the io module. Perhaps even then merge it with io.BufferedIOBase.
The idea is that all buffered reading functions (read(), read1(), readline(), peek(), etc) can be expressed in the term of one function which returns raw unbuffered data. Subclasses need define only one such function and will got all buffered reader interface. In case of mentioned above classes this functions reads and decompresses a chunk of data from underlied file. The HTTPResponse class perhaps will benefit too (issue19009). |
|
Date |
User |
Action |
Args |
2013-09-19 14:22:10 | serhiy.storchaka | set | recipients:
+ serhiy.storchaka, alanmcintyre, pitrou, nadeem.vawda, benjamin.peterson, stutzbach |
2013-09-19 14:22:09 | serhiy.storchaka | set | messageid: <1379600529.46.0.258828532264.issue19051@psf.upfronthosting.co.za> |
2013-09-19 14:22:09 | serhiy.storchaka | link | issue19051 messages |
2013-09-19 14:22:09 | serhiy.storchaka | create | |
|