[issue9299] os.mkdir() and os.makedirs() add a keyword argument to suppress "File exists" exception.

Guido van Rossum report at bugs.python.org
Wed Jul 21 09:08:52 CEST 2010


Guido van Rossum <guido at python.org> added the comment:

On Wed, Jul 21, 2010 at 3:32 AM, Terry J. Reedy <report at bugs.python.org> wrote:
>
> Terry J. Reedy <tjreedy at udel.edu> added the comment:
>
> Discussion has continued on pydev thread "mkdir -p in python". Some suggested a new function. Others questioned the details of the new behavior. Guido prefers the flag approach and imitation of mkdir -p.
>
> "-1 on a new function (despite the constant-argument
> guideline) and +1 on a flag. If it weren't for backwards compatibility
> I'd just change os.makedirs() to act like mkdir -p period, but the
> last opportunity we had for that was Python 3.0."
>
> So, the patch should either leave behavior untouched or imitate -p behavior. That to me says that the parameter passed to mkdirs should be propagated to each mkdir call, as the 9299 patch does, and not set to a fixed value.

Hm. I wonder if os.mkdir() should not be left alone (so as to continue
to match the system call most exactly, as is our convention) and the
extra functionality added to os.makedirs() only.

----------

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue9299>
_______________________________________


More information about the Python-bugs-list mailing list