Path: csiph.com!usenet.pasdenom.info!gegeweb.org!de-l.enfer-du-nord.net!feeder1.enfer-du-nord.net!cs.uu.nl!news.stack.nl!newsfeed.xs4all.nl!newsfeed3.news.xs4all.nl!xs4all!post.news.xs4all.nl!not-for-mail Return-Path: X-Original-To: python-list@python.org Delivered-To: python-list@mail.python.org X-Spam-Status: OK 0.002 X-Spam-Evidence: '*H*': 1.00; '*S*': 0.00; 'syntax': 0.04; 'argument': 0.05; 'none:': 0.07; 'translate': 0.10; 'cc:addr:python-list': 0.11; 'def': 0.12; '"def"': 0.16; '"is"': 0.16; '-tkc': 0.16; 'from:addr:python.list': 0.16; 'from:addr:tim.thechases.com': 0.16; 'from:name:tim chase': 0.16; 'invocation': 0.16; 'object()': 0.16; 'occurs.': 0.16; 'roy': 0.16; 'wrote:': 0.18; 'value.': 0.19; 'cc:addr:python.org': 0.22; 'cc:2**0': 0.24; 'cc:no real name:2**0': 0.24; 'compiled': 0.26; 'suggested': 0.26; 'pass': 0.26; 'header:In-Reply-To:1': 0.27; 'tim': 0.29; 'statement': 0.30; 'chase': 0.31; "d'aprano": 0.31; 'skip:! 10': 0.31; 'steven': 0.31; 'skip:_ 10': 0.34; 'something': 0.35; 'test': 0.35; 'charset:us-ascii': 0.36; 'somebody': 0.38; 'whatever': 0.38; 'aside': 0.39; 'skip:x 10': 0.40; 'expression': 0.60; 'real': 0.63; 'smith': 0.68; 'article': 0.77; 'received:50.22': 0.84; 'subject:Value': 0.84 Date: Thu, 20 Jun 2013 21:02:07 -0500 From: Tim Chase To: Roy Smith Subject: Re: Default Value In-Reply-To: References: <7e6361d5-6619-4aaa-adda-8b5f01bde57f@googlegroups.com> <447dd1c6-1bb2-4276-a109-78d7a067b442@d8g2000pbe.googlegroups.com> <2e92b4c7-31be-40d2-a906-ab19f3630dfa@googlegroups.com> <09cfa648-ab87-4261-b8f0-bf493de00553@4g2000pbf.googlegroups.com> <51c3a799$0$29999$c3e8da3$5496439d@news.astraweb.com> X-Mailer: Claws Mail 3.8.1 (GTK+ 2.24.10; x86_64-pc-linux-gnu) Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit X-AntiAbuse: This header was added to track abuse, please include it with any abuse report X-AntiAbuse: Primary Hostname - boston.accountservergroup.com X-AntiAbuse: Original Domain - python.org X-AntiAbuse: Originator/Caller UID/GID - [47 12] / [47 12] X-AntiAbuse: Sender Address Domain - tim.thechases.com Cc: python-list@python.org 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: 40 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1371780021 news.xs4all.nl 15877 [2001:888:2000:d::a6]:42383 X-Complaints-To: abuse@xs4all.nl Xref: csiph.com comp.lang.python:48839 On 2013-06-20 21:40, Roy Smith wrote: > In article , > Tim Chase wrote: > > > On 2013-06-21 01:08, Steven D'Aprano wrote: > > > Here's my syntax plucked out of thin air: > > > > > > def func(arg, x=expression, !y=expression): > > > ... > > > > > > where y=expression is late-bound, and the above is compiled to: > > > > > > def func(arg, x=expression, y=None): > > > if y is None: > > > y = expression > > > ... > > > > I think it would have to translate to something like > > > > _temp_semaphore = object() > > def func(arg, x=expression, y=_temp_semaphore): > > if y is _temp_semaphore: > > y = expression > > > > ... > > You can go around and around on that one. Whatever distinguished > value you set aside to mean "no argument passed", somebody will > come up with a use case for why they might want to pass that as a > real value. That's why I suggested using an "is" test against a custom/local(ish) semaphore instance that is only used for the particular invocation in which the "def" statement occurs. -tkc