Dave Abrahams <d...@boostpro.com> added the comment:

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.

----------

_______________________________________
Python tracker <rep...@bugs.python.org>
<http://bugs.python.org/issue14243>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to