Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #12462

Re: Returning a value from exec or a better solution

Path csiph.com!x330-a1.tempe.blueboxinc.net!usenet.pasdenom.info!gegeweb.org!de-l.enfer-du-nord.net!feeder2.enfer-du-nord.net!feeds.phibee-telecom.net!newsfeed.xs4all.nl!newsfeed5.news.xs4all.nl!xs4all!post.news.xs4all.nl!not-for-mail
Return-Path <arnodel@gmail.com>
X-Original-To python-list@python.org
Delivered-To python-list@mail.python.org
X-Spam-Status OK 0.009
X-Spam-Evidence '*H*': 0.98; '*S*': 0.00; '>>>>': 0.09; 'brilliant': 0.09; 'executed': 0.09; 'globals': 0.09; 'statement.': 0.09; 'am,': 0.12; 'much!': 0.15; '"def"': 0.16; 'cc:addr:python-list': 0.16; 'wrote:': 0.16; '>>>': 0.18; 'issue.': 0.19; 'cc:no real name:2**0': 0.20; "haven't": 0.20; 'wrote': 0.20; 'cc:2**0': 0.22; 'header:In-Reply-To:1': 0.22; 'tue,': 0.23; 'received:209.85.213.46': 0.23; 'received:mail- yw0-f46.google.com': 0.23; 'aug': 0.24; 'statement': 0.25; 'code.': 0.26; "i'm": 0.27; 'function': 0.27; 'message- id:@mail.gmail.com': 0.29; 'cc:addr:python.org': 0.30; 'example': 0.30; 'definition': 0.30; 'none,': 0.30; 'break': 0.32; 'that,': 0.33; '(as': 0.34; 'certain': 0.35; 'but': 0.37; 'received:google.com': 0.38; 'received:209.85': 0.38; 'subject:: ': 0.39; 'user': 0.39; 'subject:from': 0.40; 'august': 0.70; 'want,': 0.71; '30,': 0.74; 'locals': 0.84; 'subject:value': 0.84; 'subject:better': 0.93
DKIM-Signature v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type:content-transfer-encoding; bh=gX39PXA+fmdUO7l2N+BM2eWf/QOCmOxzv5mpEbzeyPQ=; b=MtxivhpTeWyj3mluAGnRglF9d5wAHun5XKMwNAglRvuvxf+ZpAH12CY2TEC8giuXyV SC16HnodHZb6uYukrgdutBvjuDX2txGK2zZeokqOUKHtarDB2Bvel/yE5GgFMX7SpKST sIVnYjc3pt9mMrc06JgTUYxrzMXYj9dqgn/7E=
MIME-Version 1.0
In-Reply-To <Xns9F51E858DCE15rtwfreenetREMOVEcouk@80.91.229.10>
References <CAG5udOg=GtFGPmTB=1OJNvNRPdYUcxDoKN1WJQMOMv9gx0+fZA@mail.gmail.com> <Xns9F50BCB7B5708rtwfreenetREMOVEcouk@80.91.229.10> <CAG5udOh1+oE4g9Frjp3pucbHUtWcN34KK35a-Xs2YqkZH9X5=w@mail.gmail.com> <CAJ6cK1ZSQJyPqOjU+TSR8mmsXWNoD9FJ2dvuQsAVEJHAWYrjHg@mail.gmail.com> <CAG5udOiOAge3uHrGSDTZ412GAg+CC-6u8iGOyJ0Lnf3HnwUVzA@mail.gmail.com> <Xns9F515822D92CrtwfreenetREMOVEcouk@80.91.229.10> <CAG5udOgxSmQrVOm+fPO_wsJsDLeR6jie0AgJFvauODd+2eA21g@mail.gmail.com> <CAJ6cK1YVi3NQgdZOUdhAESf133pUkdazM1PkSP=p6xFaYVOHYA@mail.gmail.com> <Xns9F51E858DCE15rtwfreenetREMOVEcouk@80.91.229.10>
Date Wed, 31 Aug 2011 07:35:45 +0100
Subject Re: Returning a value from exec or a better solution
From Arnaud Delobelle <arnodel@gmail.com>
To Rob Williscroft <rtw@rtw.me.uk>
Content-Type text/plain; charset=UTF-8
Content-Transfer-Encoding quoted-printable
Cc python-list@python.org
X-BeenThere python-list@python.org
X-Mailman-Version 2.1.12
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.594.1314772549.27778.python-list@python.org> (permalink)
Lines 31
NNTP-Posting-Host 2001:888:2000:d::a6
X-Trace 1314772549 news.xs4all.nl 2431 [2001:888:2000:d::a6]:39175
X-Complaints-To abuse@xs4all.nl
Xref x330-a1.tempe.blueboxinc.net comp.lang.python:12462

Show key headers only | View raw


On 30 August 2011 22:48, Rob Williscroft <rtw@rtw.me.uk> wrote:
> Arnaud Delobelle wrote in
> news:CAJ6cK1YVi3NQgdZOUdhAESf133pUkdazM1PkSP=p6xFaYVOHYA@mail.gmail.com in
> gmane.comp.python.general:
>
>> On 30 August 2011 13:31, Jack Trades <jacktradespublic@gmail.com> wrote:
>>>
>>>
>>> On Tue, Aug 30, 2011 at 2:37 AM, Rob Williscroft <rtw@rtw.me.uk> wrote:
>>>
>>>>
>>>> > That's brilliant and works flawlessly. ś˙Thank you very much!
>>>>
>>>> If an impementation (as you say up thread) can populate globals
>>>> or locals with whatever they want, then how do you know that last
>>>> item added was the function definition the user supplied ?
>
>> That's not an issue. The last statement that is executed will be the
>> "def" statement.
>
> You don't know that, an implementation may for example set __bultins__
> to None, prior to returning, its not an unreasonable thing to do and
> the docs don't say they can't.

I haven't studied the docs but I'm certain that such an implementation
would break a lot of code.

-- 
Arnaud

Back to comp.lang.python | Previous | Next | Find similar | Unroll thread


Thread

Re: Returning a value from exec or a better solution Arnaud Delobelle <arnodel@gmail.com> - 2011-08-31 07:35 +0100

csiph-web