On Tue, 17 Jul 2012 06:34:14 +0300 Eli Bendersky <eli...@gmail.com> wrote: > > Is there any reason for this to be so? What does BytesIO give us that the > second approach does not (I tried adding more methods to the patched > RawIOBase to make it more functional, like seekable() and tell(), and it > doesn't affect performance)?
Well, try implementing non-trivial methods such as readline() or seek(), and writing in the middle rather than at the end. As Nick said, we could implement the same optimization as in StringIO, i.e. only materialize the buffer when necessary. Regards Antoine. -- Software development and contracting: http://pro.pitrou.net _______________________________________________ Python-Dev mailing list Python-Dev@python.org http://mail.python.org/mailman/listinfo/python-dev Unsubscribe: http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com