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 stutzbach
Recipients benjamin.peterson, daniel.urban, jcon, pitrou, stutzbach
Date 2011-05-05.00:35:33
SpamBayes Score 5.2323367e-07
Marked as misclassified No
Message-id <1304555737.32.0.0606655470844.issue9971@psf.upfronthosting.co.za>
In-reply-to
Content
Looking at this again, I agree with John.  For BufferedIOBase, read() is abstract while readinto() is concrete.  That seems backward, and, indeed, it's the opposite of RawIOBase, where readinto() is abstract and read() is concrete.

Unfortunately, this code has shipped, so changing which methods are abstract may not be practical.  On the other hand, the documentation doesn't mention which methods are abstract versus concrete.

All of that said, we can freely change the C implementation of BufferedReader which is a concrete class.  That would allow us to cut out the extra allocoations/deallocations, even if we can't clean up the abstract vs concrete method issue.  Basically, this would require greatly expanding buffered_readinto() in bufferedio.c to use _bufferedreader_raw_read() and related functions.

As I think about this more... I'm not sure how much performance there is to gain here in practice.  It seems like any time I'd want to use readinto(), it's because I want to do my own buffering, in which case why would I use a BufferedReader?  I'm thinking that BufferedIOBase only provides a readinto() method for completeness, so it can be used as a drop-in replacement for an unbuffered file object.
History
Date User Action Args
2011-05-05 00:35:37stutzbachsetrecipients: + stutzbach, pitrou, benjamin.peterson, daniel.urban, jcon
2011-05-05 00:35:37stutzbachsetmessageid: <1304555737.32.0.0606655470844.issue9971@psf.upfronthosting.co.za>
2011-05-05 00:35:34stutzbachlinkissue9971 messages
2011-05-05 00:35:33stutzbachcreate