Rob Williscroft wrote:
Ethan Furman wrote in news:4e5d29c8.8010...@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

The docs don't say when, true -- so I don't know for sure that all additions happen before the exec since I haven't delved into the source code...

Okay, just perused builtin_exec in bltinmodule.c, and I can say that cPython (somewhere in 3.2-3.3 land) only adds __builtins__ if not already there, and that it does it first.

Which makes sense -- after all, what's the point of adding stuff to globals() *after* the code has been run?

~Ethan~
--
http://mail.python.org/mailman/listinfo/python-list

Reply via email to