Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #81559
| Path | csiph.com!usenet.pasdenom.info!dedibox.gegeweb.org!gegeweb.eu!nntpfeed.proxad.net!proxad.net!feeder1-2.proxad.net!usenet-fr.net!nerim.net!novso.com!newsfeed.xs4all.nl!newsfeed4a.news.xs4all.nl!xs4all!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.011 |
| X-Spam-Evidence | '*H*': 0.98; '*S*': 0.00; 'compiler': 0.07; 'though:': 0.07; 'namespace': 0.09; 'cc:addr:python-list': 0.11; 'python': 0.11; 'def': 0.12; 'mostly': 0.14; "'q'": 0.16; 'declaration': 0.16; 'from:addr:rosuav': 0.16; 'from:name:chris angelico': 0.16; 'kasper': 0.16; 'weird': 0.16; 'all.': 0.16; 'wrote:': 0.18; 'do.': 0.18; 'library': 0.18; 'wed,': 0.18; 'seems': 0.21; 'example': 0.22; 'otherwise,': 0.22; 'cc:addr:python.org': 0.22; 'creating': 0.23; 'of.': 0.24; 'space.': 0.24; 'fairly': 0.24; 'cc:2**0': 0.24; 'header:In-Reply- To:1': 0.27; "doesn't": 0.30; 'message-id:@mail.gmail.com': 0.30; 'skip:c 30': 0.32; 'older': 0.33; 'maybe': 0.34; 'agree': 0.35; 'something': 0.35; 'but': 0.35; 'received:google.com': 0.35; 'nov': 0.38; 'pm,': 0.38; 'even': 0.60; 'around.': 0.60; 'affect': 0.61; "you're": 0.61; 'information': 0.63; 'more': 0.64; 'different': 0.65; 'side': 0.67; 'natural': 0.68; '26,': 0.68; 'transfer': 0.82; 'tricky': 0.84; 'to:none': 0.92 |
| DKIM-Signature | v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:date:message-id:subject:from:cc :content-type; bh=wyRrn1BDXIJaQgxgKcmnsG1+Pk/OQ3OBxEEz9jx4xn0=; b=J1OP6UlotLpWAUZrFmZYrwxg7zMvpg23bkWHRuZaCJ6S20YsTHrNIjM1VelBuGvQz3 lwUbvGGXYNxB6TGtPzN16RGXamqIDTzl/xJUMW4+8r01aHlvgrJPqtP6IKQwOcnf9QQM MFOoRl/PJTKkbHoud6eJe76CMSjJnYFR6W720m9Uguk4qcob/WZww6pwSflmO+qI+0eV VLL/rv6EFt1pZApZvPpmIXZk5xhTAKN2ZJnJyhsDCmRPmR4SZq373yV38YWUUV3WXkXI ZrL6T4lZt/WdhMAsgwoAXHrhaB1ybtcBVh72ViOl1V0s1ED5DNL8yM3prtm50CfhtAGy XhQw== |
| MIME-Version | 1.0 |
| X-Received | by 10.107.17.79 with SMTP id z76mr28312498ioi.27.1416999093937; Wed, 26 Nov 2014 02:51:33 -0800 (PST) |
| In-Reply-To | <20141126104628.78ed4022@klug> |
| References | <20141126102257.141b108f@klug> <CAPTjJmov9s=_0yVSOYSRqoCoy69vyXCKvUpScirjBQDp28Sd4A@mail.gmail.com> <20141126104628.78ed4022@klug> |
| Date | Wed, 26 Nov 2014 21:51:33 +1100 |
| Subject | Re: PyEval_GetLocals and unreferenced variables |
| From | Chris Angelico <rosuav@gmail.com> |
| Cc | "python-list@python.org" <python-list@python.org> |
| Content-Type | text/plain; charset=UTF-8 |
| 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 | <https://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 | <https://mail.python.org/mailman/listinfo/python-list>, <mailto:python-list-request@python.org?subject=subscribe> |
| Newsgroups | comp.lang.python |
| Message-ID | <mailman.16318.1416999097.18130.python-list@python.org> (permalink) |
| Lines | 27 |
| NNTP-Posting-Host | 2001:888:2000:d::a6 |
| X-Trace | 1416999097 news.xs4all.nl 2943 [2001:888:2000:d::a6]:38807 |
| X-Complaints-To | abuse@xs4all.nl |
| Xref | csiph.com comp.lang.python:81559 |
Show key headers only | View raw
On Wed, Nov 26, 2014 at 9:46 PM, Kasper Peeters <kasper@phi-sci.com> wrote: > I agree that in this example that would be the natural thing to do. > My case is more tricky though: I have something like > > def fun(): > cfun_that_creates_q_in_local_scope() > def fun2(): > cfun_that_wants_to_see_if_q_is_available() > > So the Python side actually doesn't see 'q' directly at all. > > I am willing to elaborate on this if you want (I have fairly good > reasons to do things this way, mostly having to do with historical > constraints of an older C library that I cannot avoid), but it > requires more space. > To be honest, that's just made it even more weird :) You're creating something in a local namespace that the Python compiler isn't aware of. I wonder, would a 'nonlocal q' declaration inside fun2 affect things any? Otherwise, maybe there's some completely different way to transfer information around. Using locals in this way seems fraught with peril. ChrisA
Back to comp.lang.python | Previous | Next | Find similar | Unroll thread
Re: PyEval_GetLocals and unreferenced variables Chris Angelico <rosuav@gmail.com> - 2014-11-26 21:51 +1100
csiph-web