Returning a value from exec or a better solution

Rob Williscroft rtw at rtw.me.uk
Tue Aug 30 15:28:52 EDT 2011


Ethan Furman wrote in news:4E5D29C8.8010206 at stoneleaf.us in 
gmane.comp.python.general:

> Jack Trades wrote:
>> On Tue, Aug 30, 2011 at 2:37 AM, Rob Williscroft wrote:
>>> 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 ?
> 
> Because the implementation will add things before the exec is processed. 

How do you know this ?, it isn't what the docs say.

http://docs.python.org/reference/simple_stmts.html#the-exec-statement

Rob.




More information about the Python-list mailing list