Return-Path: X-Original-To: python-list@python.org Delivered-To: python-list@mail.python.org X-Spam-Status: OK 0.024 X-Spam-Evidence: '*H*': 0.95; '*S*': 0.00; 'exists.': 0.07; 'modes': 0.09; '"0"': 0.16; 'from:addr:greg.ewing': 0.16; 'from:name:greg ewing': 0.16; 'message-id:@canterbury.ac.nz': 0.16; 'received :conversion-daemon.it.canterbury.ac.nz': 0.16; 'simpson': 0.16; 'write,': 0.16; 'wrote:': 0.18; 'header:User-Agent:1': 0.23; 'greg': 0.24; 'right.': 0.26; 'thus': 0.29; 'received:132': 0.31; 'file': 0.32; 'know.': 0.32; 'quite': 0.32; 'open': 0.33; 'skip:_ 10': 0.34; 'really': 0.36; 'to:addr:python-list': 0.38; 'to:addr:python.org': 0.39; 'received:nz': 0.60; 'lack': 0.78; 'header:In-reply-to:1': 0.84; 'subject:skip:o 10': 0.84 Date: Fri, 10 May 2013 10:56:45 +1200 From: Greg Ewing Subject: Re: object.enable() anti-pattern In-reply-to: <20130509082331.GA46022@cskk.homeip.net> To: python-list@python.org MIME-version: 1.0 Content-type: text/plain; charset=ISO-8859-1; format=flowed Content-transfer-encoding: 7bit X-Accept-Language: en-us, en User-Agent: Mozilla Thunderbird 1.0.5 (Macintosh/20050711) References: <20130509082331.GA46022@cskk.homeip.net> X-BeenThere: python-list@python.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: General discussion list for the Python programming language List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Newsgroups: comp.lang.python Message-ID: Lines: 12 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1368140219 news.xs4all.nl 15998 [2001:888:2000:d::a6]:57825 X-Complaints-To: abuse@xs4all.nl Path: csiph.com!usenet.pasdenom.info!news.stben.net!border3.nntp.ams.giganews.com!border1.nntp.ams.giganews.com!nntp.giganews.com!xlned.com!feeder7.xlned.com!newsfeed.xs4all.nl!newsfeed3.news.xs4all.nl!xs4all!post.news.xs4all.nl!not-for-mail Xref: csiph.com comp.lang.python:45061 Cameron Simpson wrote: > You open a file with "0" modes, so > that it is _immediately_ not writable. Other attempts to make the > lock file thus fail because of the lack of write, I don't think that's quite right. You open it with O_CREAT+O_EXCL, which atomically fails if the file already exists. The read/write modes don't really come into it, as far as I know. -- Greg