Guido van Rossum added the comment: 2007/10/25, Yitz Gale <[EMAIL PROTECTED]>: > 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) try: process(f) finally: f.close() or, if you want: with open(filename) as f: process(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. :-) __________________________________ Tracker <[EMAIL PROTECTED]> <http://bugs.python.org/issue1286> __________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com