Author dabrahams
Recipients brian.curtin, dabrahams, eric.smith, ncoghlan, pitrou, tim.golden
Date 2012-03-12.17:59:51
SpamBayes Score 9.36828e-12
Marked as misclassified No
Message-id <1331575192.82.0.86730352066.issue14243@psf.upfronthosting.co.za>
In-reply-to
Content
Nick, not to belabor this, but I guess you don't understand the use-case in question very well, or you'd see that delete=False doesn't cover it.

The use case is this: I have to write a test for a function that takes a filename as a parameter and opens and reads from the file with that name.  The test should conjure up an appropriate file, call the function, check the results, and clean up the file afterwards.  It doesn't matter when the file gets cleaned up, as long as it is cleaned up "eventually."  Having to explicitly delete the file is exactly the kind of boilerplate one wants to avoid in situations like this.

Even if Windows allows a file to be opened for reading (in some circumstances) when it is already open for writing, it isn't hard to imagine that Python might someday have to support an OS that didn't allow it under any circumstances.  It is also a bit perverse to have to keep the file open for writing after you're definitively done writing it, just to prevent it from being deleted prematurely.  I can understand most of the arguments you make against close-without-delete, except those (like the above) that seem to come from a "you shouldn't want that; it's just wrong" stance.
History
Date User Action Args
2012-03-12 17:59:52dabrahamssetrecipients: + dabrahams, ncoghlan, pitrou, eric.smith, tim.golden, brian.curtin
2012-03-12 17:59:52dabrahamssetmessageid: <1331575192.82.0.86730352066.issue14243@psf.upfronthosting.co.za>
2012-03-12 17:59:52dabrahamslinkissue14243 messages
2012-03-12 17:59:51dabrahamscreate