
On Nov 16, 2019, at 13:13, Greg Ewing greg.ewing@canterbury.ac.nz wrote:
It might be better to keep it as purely a context manager, and not load it down with any other baggage.
Doesn’t `closing` already take care of that (and other things besides files, too)?
I’m not really sure what problem we’re trying to solve here. Having a way to construct file objects without opening them, so you can do all the actual opens in a with statement, and there’s no easy way to get it wrong? (Which still wouldn’t really be true, because there’s always the trap of writing a generator function that uses a with that only cleans up if the generator is cleaned up…) Or breaking file objects up into as many orthogonal pieces as possible to see if there’s a better way to reassemble them?