Message 150194 - Python tracker (original) (raw)

On Fri, Dec 23, 2011 at 10:35 PM, Antoine Pitrou <report@bugs.python.org>wrote:

os.rename(overwrite=False) by default will do less harm than the opposite,

Disagreed.

Fine. No arguments == no consensus.

Then I believe that having a small chance of overwriting file just created at exactly the same moment on a POSIX is a small price to pay for function that does safety check before rename on a platform that doesn't have such functionality at all.

Disagreed. If you need the functionality, it's one additional line of code. Not every trivial function deserves to be in the stdlib.

As a Windows programmer I am quite surprised to read this thread with information that on Linux os.rename() overwrites files without questions, so as I Windows programmer I want os.rename() to stop that. I always guard my code against accidental rewrite by catching the exception. EAFP and all that stuff. But there is no way I can ask forgiveness when files are already overwritten.