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


Groups > comp.lang.python > #12455

Re: Returning a value from exec or a better solution

Date 2011-08-30 15:31 -0700
From Ethan Furman <ethan@stoneleaf.us>
Subject Re: Returning a value from exec or a better solution
References (4 earlier) <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>
Newsgroups comp.lang.python
Message-ID <mailman.588.1314742485.27778.python-list@python.org> (permalink)

Show all headers | View raw


Rob Williscroft wrote:
> Arnaud Delobelle wrote:
> 
>> 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.

Actually, I think it is unreasonable -- by modifying the globals or 
locals objects *after* the code has been exec'd, information is being 
removed about the environment the code ran in, making introspection (if 
nothing else) more difficult.

Good reasons are required to make life difficult (at least with Python).

~Ethan~

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


Thread

Re: Returning a value from exec or a better solution Ethan Furman <ethan@stoneleaf.us> - 2011-08-30 15:31 -0700

csiph-web