This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author gvanrossum
Recipients alexandre.vassalotti, georg.brandl, gvanrossum, ygale
Date 2007-10-25.22:48:58
SpamBayes Score 0.11621407
Marked as misclassified No
Message-id <>
In-reply-to <>
2007/10/25, Yitz Gale <>:
> I was actually bitten badly by this issue with
> StringIO. I added fileinput only as an afterthought.
> In an xml.sax app, I needed seek() support for a
> codec-wrapped file handle, so I over-wrapped it with
> StringIO. The result was that I had to refactor code all over
> the place to handle StringIO as a special case. What a
> mess!

I don't understand. What did your code look like after the refactoring?

I find that typically a useful idiom is to have one piece of code
handle opening/closing of streams and let the rest of the code just
deal with streams without ever closing them. E.g.

f = open(filename)

or, if you want:

with open(filename) as f:

As I don't understand how you are working the StringIO() call into
this I'm still not sure what the issue is.

> Why is this getting over-excited? It's a very
> lightweight change. You can't beat the cost/benefit ratio.

Until you submit a patch it's more work for me. :-)
Date User Action Args
2007-10-25 22:48:59gvanrossumsetspambayes_score: 0.116214 -> 0.11621407
recipients: + gvanrossum, georg.brandl, ygale, alexandre.vassalotti
2007-10-25 22:48:59gvanrossumlinkissue1286 messages
2007-10-25 22:48:58gvanrossumcreate