StringIO objects sharing a buffer

Mathias Waack M.Waack at gmx.de
Tue Feb 15 12:05:41 EST 2005


Thomas Lotze wrote:

> Is there a way for multiple StringIO objects to share a buffer of
> data, or do I have to give up on subclassing StringIO for this
> purpose? (An alternative would be a tokenizer class that has a
> StringIO instead of being one and do the file pointer housekeeping
> in there.)

I'm not sure if I understand the problem right, but there is a rule
of thumb: 
Prefer delegation to inheritance. If you can use delegation, avoid
inheritance. Esp. on python, where (from the point of view of usage)
there is no distinction between delegation or inheritance. 

Mathias



More information about the Python-list mailing list