Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #29555
| Path | csiph.com!usenet.pasdenom.info!aioe.org!news.stack.nl!newsfeed.xs4all.nl!newsfeed6.news.xs4all.nl!xs4all!post.news.xs4all.nl!not-for-mail |
|---|---|
| Return-Path | <kwatch@gmail.com> |
| X-Original-To | python-list@python.org |
| Delivered-To | python-list@mail.python.org |
| X-Spam-Status | OK 0.010 |
| X-Spam-Evidence | '*H*': 0.98; '*S*': 0.00; 'subject:: [': 0.03; 'subject:code': 0.07; 'subject:How': 0.09; 'received:mail- qc0-f174.google.com': 0.09; 'sep': 0.09; '2",': 0.16; 'bytecode': 0.16; 'globals(),': 0.16; 'subject:object': 0.16; 'wrote:': 0.17; 'thu,': 0.17; 'sender:addr:gmail.com': 0.18; 'subject:] ': 0.19; 'header:In-Reply-To:1': 0.25; 'message-id:@mail.gmail.com': 0.27; '>>>>': 0.29; 'function': 0.30; 'code': 0.31; 'to:addr:python- list': 0.33; 'received:google.com': 0.34; 'pm,': 0.35; 'subject:?': 0.35; "won't": 0.35; 'received:209.85': 0.35; 'there': 0.35; 'subject:with': 0.36; 'uses': 0.37; 'received:209': 0.37; 'received:209.85.216': 0.37; 'object': 0.38; 'instead': 0.39; 'to:addr:python.org': 0.39; 'header:Received:5': 0.40; 'between': 0.63; 'different': 0.63; '20,': 0.65; 'otten': 0.84 |
| DKIM-Signature | v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:sender:in-reply-to:references:date :x-google-sender-auth:message-id:subject:from:to:content-type; bh=WQ+hwdLiH5YtYi74knV8EFkIjmCdSA/Jsm9stQnyWPQ=; b=Lc7hUdtJZhRMf0+cRpwOgpRUOIg0652vxsVCnRzJNoxT6PZuJ2oicd60eeK8U1/Bwy iv6OREIa2D3XjIhUumh7uIkTLGOMn4dV+XGSFXjiF+DNVISZc/Krq36qvjxFLV3esIVG ezA9y17CoSEBLN5atY+kY3txd9PP0xB13nzU03zSeloJA2DL5n4v0EcvIOlISq10epHt bJYXlk8wWAJaUSzfX675wlri2gVBmwLU270sDVrJr0dlpxOyT9dAM1myM/xfGr+UrTjW aB/hH7/wliQaZVB0nCzJTHPexkaGUtHPl2shdAlCgA9PwlEiIaKOUtnENi8+/k5wq0bL kmuw== |
| MIME-Version | 1.0 |
| Sender | kwatch@gmail.com |
| In-Reply-To | <k3f4ri$m30$1@ger.gmane.org> |
| References | <CAFTm5Ru=E8Zii4k54fc4ii43wKPSwTq=iT4iRQCWy=46YiEZZw@mail.gmail.com> <k3f4ri$m30$1@ger.gmane.org> |
| Date | Fri, 21 Sep 2012 00:40:15 +0900 |
| X-Google-Sender-Auth | sZnGnYP6sOOTs7_aSehs478hfc8 |
| Subject | Re: [Q] How to exec code object with local variables specified? |
| From | Makoto Kuwata <kwa@kuwata-lab.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.961.1348155619.27098.python-list@python.org> (permalink) |
| Lines | 20 |
| NNTP-Posting-Host | 2001:888:2000:d::a6 |
| X-Trace | 1348155619 news.xs4all.nl 6853 [2001:888:2000:d::a6]:55431 |
| X-Complaints-To | abuse@xs4all.nl |
| Xref | csiph.com comp.lang.python:29555 |
Show key headers only | View raw
On Thu, Sep 20, 2012 at 10:15 PM, Peter Otten <__peter__@web.de> wrote:
>
>>>> loc = {}
>>>> exec("x = 1; y = 2", globals(), loc)
>>>> loc
> {'y': 2, 'x': 1}
>
> However, this won't work with the code object taken from a function which
> uses a different a bytecode (STORE_FAST instead of STORE_NAME):
>
Is there any way to use STORE_FAST instead of STORE_NAME?
exec("string", ...) is not a solution for me.
# What is different between fn.func_code and compile("string")?
--
regards,
makoto kuwata
Back to comp.lang.python | Previous | Next | Find similar | Unroll thread
Re: [Q] How to exec code object with local variables specified? Makoto Kuwata <kwa@kuwata-lab.com> - 2012-09-21 00:40 +0900
csiph-web