[Python-ideas] Add create mode to open()

Antoine Pitrou solipsis at pitrou.net
Wed Aug 17 11:30:25 CEST 2011

On Wed, 17 Aug 2011 14:11:32 +1000
Nick Coghlan <ncoghlan at gmail.com> wrote:
> On Wed, Aug 17, 2011 at 1:43 PM, Devin Jeanpierre
> <jeanpierreda at gmail.com> wrote:
> > I'd also point out that for those that don't want race conditions,
> > Python is discouraging. The correct incantation involves two
> > undocumented constants, plus a unique and rarely used way of opening
> > files that involves unix file descriptors.
> FWIW, when you control the filename, you can include an additional
> subdirectory precisely for the exception when a second process
> attempts to create the same subdirectory.

How do you create a directory and a file atomically?



More information about the Python-ideas mailing list