[Python-ideas] Implementation of shutil.move

David Townshend aquavitae69 at gmail.com
Mon Aug 15 14:59:14 CEST 2011


I'll have a look at open() later and see if I can write a patch for python
3.  I'm not sure its worth that amount of work for python 2 at this stage in
it's lifecycle.

I'll also have a look at whether its possible to provide a safe alternative
to move and copyfile, even if it cannot be used on all systems. I'm not
thinking of actively hostile environments so much as multi-user situations.

On Mon, Aug 15, 2011 at 2:40 PM, Christian Heimes <lists at cheimes.de> wrote:

> Am 15.08.2011 14:20, schrieb David Townshend:
> > Good point.  Perhaps the best way of improving this would be to add a 'c'
> > mode to the builtin open() for creating new files, so that typical usage
> > would be open(file, 'cw').  Or maybe 'c' should imply 'w', since there
> seems
> > little point in creating a new file read-only.
>
> For Python 2 it's not possible because Python's internal file API uses
> fopen(3). fopen(3) has a limited set of flags and exclusive create isn't
> one of them. You'd have to rewrite larger parts of the API.
>
> Python 3's io library is build around file descriptors returned from
> open(2). It shouldn't be hard to write a 'c' flag for io.
>
> Christian
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-ideas/attachments/20110815/a2dbca02/attachment.html>


More information about the Python-ideas mailing list