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


Groups > comp.lang.python > #12449 > unrolled thread

Re: Returning a value from exec or a better solution

Started byArnaud Delobelle <arnodel@gmail.com>
First post2011-08-30 22:05 +0100
Last post2011-08-30 22:05 +0100
Articles 1 — 1 participant

Back to article view | Back to comp.lang.python

This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by below is the oldest one visible, not the original post.


Contents

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

#12449 — Re: Returning a value from exec or a better solution

FromArnaud Delobelle <arnodel@gmail.com>
Date2011-08-30 22:05 +0100
SubjectRe: Returning a value from exec or a better solution
Message-ID<mailman.582.1314738309.27778.python-list@python.org>
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.

>> Rob.
>
> I spoke a bit too soon with the "works flawlessly" post.  In addition to
> your issue, there is also the problem that supplying an empty environment
> does not allow the user to call necessary functions (like scheme_eval).

You could simply prepend the function definition string with whatever
imports are needed.

-- 
Arnaud

[toc] | [standalone]


Back to top | Article view | comp.lang.python


csiph-web