[Python-Dev] cpython: Issue #12451: Add support.create_empty_file()

Antoine Pitrou solipsis at pitrou.net
Fri Jul 1 11:24:53 CEST 2011


On Thu, 30 Jun 2011 23:25:59 +0200
victor.stinner <python-checkins at python.org> wrote:
> http://hg.python.org/cpython/rev/0c49260e85a0
> changeset:   71103:0c49260e85a0
> user:        Victor Stinner <victor.stinner at haypocalc.com>
> date:        Thu Jun 30 23:25:47 2011 +0200
> summary:
>   Issue #12451: Add support.create_empty_file()
> 
> We don't need to create a temporary buffered binary or text file object just to
> create an empty file.

Is there a reason for this?
I find it quite explicit and obvious what the following does:

    with open("somefile", "wb"):
        pass

so I wonder what replacing it with support.create_empty_file() brings
(except from having to lookup yet another helper function).

Regards

Antoine.




More information about the Python-Dev mailing list