Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #45620
| Path | csiph.com!usenet.pasdenom.info!weretis.net!feeder1.news.weretis.net!feeder.erje.net!eu.feeder.erje.net!newsfeed.freenet.ag!news2.euro.net!newsgate.cistron.nl!newsgate.news.xs4all.nl!post.news.xs4all.nl!not-for-mail |
|---|---|
| Return-Path | <rosuav@gmail.com> |
| X-Original-To | python-list@python.org |
| Delivered-To | python-list@mail.python.org |
| X-Spam-Status | OK 0.021 |
| X-Spam-Evidence | '*H*': 0.96; '*S*': 0.00; 'cpython': 0.05; 'assignment': 0.07; 'subject:help': 0.08; 'decorator': 0.09; 'sure,': 0.09; 'def': 0.12; 'clear.': 0.16; 'fancy': 0.16; 'from:addr:rosuav': 0.16; 'from:name:chris angelico': 0.16; "function's": 0.16; 'rebound': 0.16; 'referencing': 0.16; 'statement.': 0.16; 'language': 0.16; 'wrote:': 0.18; 'skip:p 40': 0.19; 'code,': 0.22; 'example': 0.22; 'previously': 0.22; 'print': 0.22; 'fairly': 0.24; 'mon,': 0.24; 'references': 0.26; 'header :In-Reply-To:1': 0.27; 'function': 0.29; 'chris': 0.29; 'am,': 0.29; 'statement': 0.30; 'message-id:@mail.gmail.com': 0.30; 'older': 0.33; 'reader': 0.33; 'comment': 0.34; 'could': 0.34; 'subject:with': 0.35; "can't": 0.35; 'received:209.85': 0.35; 'received:209.85.220': 0.35; 'but': 0.35; 'received:google.com': 0.35; 'next': 0.36; 'received:209': 0.37; 'whatever': 0.38; 'to:addr:python-list': 0.38; 'pm,': 0.38; 'to:addr:python.org': 0.39; 'skip:p 20': 0.39; 'even': 0.60; 'new': 0.61; "you're": 0.61; 'guarantee': 0.63; 'name': 0.63; 'more': 0.64; 'side': 0.67; '20,': 0.68; 'default': 0.69; 'hand': 0.80; 'ambiguous': 0.84; 'batchelder': 0.84; 'universally': 0.84; '2013': 0.98 |
| DKIM-Signature | v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:x-received:in-reply-to:references:date:message-id :subject:from:to:content-type; bh=oIwpqAamg9RUUhr0HRkwdtmRuIid0AHdOCppwsIL9Xs=; b=EBn/pAyKfd+jeCjYkue382kOV+YBSmUKHtCQt4N6GrW0d1g6YQyVvdBFPawmx7DdQE w249wUdmUD0+mHAnmx/fO6eQRy7N2M30LY5juRG8VLGGVcD1M49T8D345EJssCPg+aLE CjDTUUd7HHeGv/13QXpfiQEy7P/QxSfNjNUEVA+GddcgyvuDQLJq5oPZuKqul1ak8vNH jb+RZVs9OZbSihq1aZY68wza/rUchB559EpVP8dfgHY8afH8dUuQ1olv1nJ4Uc70yyN5 Q6D2Uwg/wXWa5MNLb3uWAXsu5F8J7763TwVP0LEMas4O2m1xz6E3GZVaACoG2WmQbDXw CK2w== |
| MIME-Version | 1.0 |
| X-Received | by 10.58.133.81 with SMTP id pa17mr34159993veb.37.1369061545993; Mon, 20 May 2013 07:52:25 -0700 (PDT) |
| In-Reply-To | <5199FF0E.8000600@nedbatchelder.com> |
| References | <CAPTjJmoxaieL-kwTfuHBV=jDeLpLF2=W8mzx7sv=83MwTDGZQw@mail.gmail.com> <20130520095419.GA14050@cskk.homeip.net> <CAPTjJmrEW5x0V=yju-R820Bume81HMNEHhauK0O4S6PB7mNO=A@mail.gmail.com> <5199FF0E.8000600@nedbatchelder.com> |
| Date | Tue, 21 May 2013 00:52:25 +1000 |
| Subject | Re: Please help with Threading |
| From | Chris Angelico <rosuav@gmail.com> |
| To | python-list@python.org |
| Content-Type | text/plain; charset=ISO-8859-1 |
| X-BeenThere | python-list@python.org |
| X-Mailman-Version | 2.1.15 |
| Precedence | list |
| List-Id | General discussion list for the Python programming language <python-list.python.org> |
| List-Unsubscribe | <http://mail.python.org/mailman/options/python-list>, <mailto:python-list-request@python.org?subject=unsubscribe> |
| List-Archive | <http://mail.python.org/pipermail/python-list/> |
| List-Post | <mailto:python-list@python.org> |
| List-Help | <mailto:python-list-request@python.org?subject=help> |
| List-Subscribe | <http://mail.python.org/mailman/listinfo/python-list>, <mailto:python-list-request@python.org?subject=subscribe> |
| Newsgroups | comp.lang.python |
| Message-ID | <mailman.1889.1369061554.3114.python-list@python.org> (permalink) |
| Lines | 40 |
| NNTP-Posting-Host | 2001:888:2000:d::a6 |
| X-Trace | 1369061554 news.xs4all.nl 15974 [2001:888:2000:d::a6]:36376 |
| X-Complaints-To | abuse@xs4all.nl |
| Xref | csiph.com comp.lang.python:45620 |
Show key headers only | View raw
=On Mon, May 20, 2013 at 8:46 PM, Ned Batchelder <ned@nedbatchelder.com> wrote: > On 5/20/2013 6:09 AM, Chris Angelico wrote: >> >> Referencing a function's own name in a default has to have one of >> these interpretations: >> >> 1) It's a self-reference, which can be used to guarantee recursion >> even if the name is rebound >> 2) It references whatever previously held that name before this def >> statement. > > > The meaning must be #2. A def statement is nothing more than a fancy > assignment statement. Sure, but the language could have been specced up somewhat differently, with the same syntax. I was fairly confident that this would be universally true (well, can't do it with 'print' per se in older Pythons, but for others); my statement about CPython 3.3 was just because I hadn't actually hunted down specification proof. > So your "apparently recursive" print function is no more > ambiguous "x = x + 1". The x on the right hand side is the old value of x, > the x on the left hand side will be the new value of x. > > # Each of these updates a name > x = x + 1 > > def print(*args,print=print,lock=Lock(),**kwargs): > with lock: > print(*args,**kwargs) Yeah. The decorator example makes that fairly clear. > Of course, if you're going to use that code, a comment might be in order to > help the next reader through the trickiness... Absolutely!! ChrisA
Back to comp.lang.python | Previous | Next | Find similar | Unroll thread
Re: Please help with Threading Chris Angelico <rosuav@gmail.com> - 2013-05-21 00:52 +1000
csiph-web