Neil Cerutti <horpner@yahoo.com> wrote:
> The documentation says the following about StringIO.close:
>
> close( )
> Free the memory buffer.
>
> Or else... what?
Or else the memory buffer sticks around, so you can keep calling
getvalue as needed. I believe the freeing will happen anyway,
eventually, if and when the StringIO instance is garbage collected (just
like, say, a file object's underlying fd gets closed when the file
object is garbage collected), but relying on such behavior is often
considered a dubious practice nowadays (given the existence of many
Python implementations whose GC strategies differ).
Alex