Re:A Python Mystery
by revelation on Monday April 30, 2012 @05:27PM
(#3911608)
At least for Python 2.7, you would expect the code run with exec to share the locals and globals with the environment where you called exec from. Thats why the x = x + 1 works, after all.
I'm in the process of blogging about this and other quirks of exec -- I'll post back here once that's up.