[Python-ideas] seperating streams from there underlying buffer

Daniel Stutzbach daniel at stutzbachenterprises.com
Wed Apr 15 14:13:37 CEST 2009


On Tue, Apr 14, 2009 at 5:08 PM, Benjamin Peterson <benjamin at python.org>wrote:

> Currently, If you want write/read binary from a stream you are using
> TextIOWrapper with you must keep the TextIOWrapper alive otherwise, it will
> close the underlying buffer. I think we should provide a disconnect()
> method for
> BufferedIOBase and TextIOBase that removes from the wrapper and returns raw
> stream or buffer respectively.
>

I'd rather that wrapper objects not close the underlying object when garbage
collected.  Better to let the underlying object close itself when garbage
collected.  An explicit call to close() should still work, of course.

Basically, move the __del__ from IOBase to RawIOBase.  Maybe it's too late
to make that change, though. :-(

--
Daniel Stutzbach, Ph.D.
President, Stutzbach Enterprises, LLC <http://stutzbachenterprises.com>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-ideas/attachments/20090415/f7d1057e/attachment.html>


More information about the Python-ideas mailing list