[Python-ideas] Implementation of shutil.move

Steven D'Aprano steve at pearwood.info
Sun Aug 14 16:30:39 CEST 2011


Christian Heimes wrote:
> Am 14.08.2011 08:01, schrieb David Townshend:
>> The latest idea (which I've now described on the issue tracker), is not to
>> use os.open(), rather os.link() and os.unlink(), which should work the same
>> across platforms.  Please could someone correct me if I'm wrong about this.
> 
> My proposed link() / unlink() procedure works only on platforms and file
> systems, that support hard links. I totally forgot about the file system
> issue, sorry. :)


It seems to me that these various "safe-ish move" procedures should be 
added to shutil, as separate functions, and the limitations of each 
documented. The caller then can decide which, if any, they are going to use.

Avoiding race conditions when renaming or copying files is a hard 
problem. Who says that there is one solution that will work everywhere?




-- 
Steven



More information about the Python-ideas mailing list