Bare Excepts

Aahz aahz at
Fri Jan 22 22:52:34 CET 2010

In article <80c56956-f28e-47a3-a723-3a5e3fd294b0 at>,
sjdevnull at <sjdevnull at> wrote:
>On Jan 2, 9:35=A0pm, Dave Angel <da... at> wrote:
>> In Windows, there is a way to do it. It's just not exposed to the
>> Python built-in function open(). You use the CreateFile() function,
>> with /dwCreationDisposition/ of CREATE_NEW.
>> It's atomic, and fails politely if the file already exists.
>> No idea if Unix has a similar functionality.
>It does.   In Unix, you'd pass O_CREAT|O_EXCL to the open(2) system
>call (O_CREAT means create a new file, O_EXCL means exclusive mode:
>fail if the file exists already).

Aahz (aahz at           <*>

import antigravity

More information about the Python-list mailing list