[issue15084] Add option to os.makefile to not raise an exception for existing directories
New submission from Raymond Hettinger raymond.hettin...@gmail.com: I commonly see the code pattern: try: os.mkdir(dirname) except OSError: pass It would be nice to have this instead: os.mkdir(dirname, ignore_if_existing=True) There's probably a better name for the keyword argument, but it communicates the idea clearly enough. -- messages: 162956 nosy: rhettinger priority: normal severity: normal status: open title: Add option to os.makefile to not raise an exception for existing directories type: enhancement versions: Python 3.4 ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue15084 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue15084] Add option to os.makefile to not raise an exception for existing directories
Serhiy Storchaka storch...@gmail.com added the comment: Agree. First, the use of parameter is shorter (1 line instead of 4). Second, try/except idiom hides possible real OS errors (no rights to create the directory, a non-directory file with the same name already exists, illegal filename, too long patch, etc.). But ignore_if_existing is not good name for my taste. -- components: +Library (Lib) nosy: +storchaka ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue15084 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue15084] Add option to os.makefile to not raise an exception for existing directories
Hynek Schlawack h...@ox.cx added the comment: +1. Raymond, is there a reason you put that for 3.4? I'd try to get it in before beta1 next week, it's trivial enough. Regarding the name: os.makedirs() uses exist_ok, we shouldn't invent new ones. -- assignee: - hynek nosy: +hynek ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue15084 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com