From: Mark Sparshatt Date: 2004-04-24T05:00:39+09:00 Subject: Re: StringIO Hal Fulton wrote: > I've been playing with StringIO, and I've found that it doesn't inherit > from IO. > > I had thought this would be natural, as it would in theory permit us to > use a StringIO wherever an IO is used. > Well as long as the code doesn't check the class of it's parameters and just relies on duck typing it should still be possible to use a StringIO in place of an IO object. However, IIRC there are parts of the core language that do explicitly check that they're receiving a string, for speed reasons, so having StringIO inherit from String makes more sense. -- Mark Sparshatt