3 ms·
> Was this a good decision? Personally, i don't think so. I think the opposite. I've had issues with TextIOWrapper because it does (unexpectedly) take ownershi
by masklinn 6y ago
> Was this a good decision? Personally, i don't think so.
I think the opposite. I've had issues with TextIOWrapper because it does (unexpectedly) take ownership of the IO object you give it, and closes it. Learned that the hard way, and had to replace TextIOWrapper by `codecs` reader and writer.
> There is nothing useful you can do with an IO object once a CSV reader has used it
You can seek the data back to the start to re-read it differently. Though I'll acknowledge that it's significantly more useful for a csv writer (and then if reader and writer diverge you've created an inconvenient asymmetry).
> This is compounded by the fact that there is no way to obtain the underlying IO object from a CSV reader, so you have to hold on to the files separately.
Not exactly a difficult feat.