No os.copy()? Why not?

Evan Driscoll driscoll at cs.wisc.edu
Tue Apr 3 16:21:25 EDT 2012


On 01/-10/-28163 01:59 PM, Tycho Andersen wrote:
> Note, though, that this reads the whole file into memory. As many
> others have said, shutil is the most idiomatic option.

* most idiomatic
* clearest in terms of showing intent
* potentially fastest
* hardest to screw up (unlike concatenating file names into a
   'system' call)
* has at least a snowball's chance of persisting metadata associated
   with the file (even if shutil doesn't now, it could theoretically
   change)
* portable

There's basically nothing NOT to like about shutil, and at least one 
significant problems with all the other suggestions.

Evan



More information about the Python-list mailing list