Re: [Tutor] The exec command and namespaces

2012-08-10 Thread Jerry Hill
On Fri, Aug 10, 2012 at 4:44 PM, Jaidev Deshpande wrote: > Hi, > > Supposed I have a string containing a python script and I exec that script. > > Is there a way to keep track of the variables that this exec() command > creates? Sure. You can provide the dictionaries that exec will use for glob

[Tutor] The exec command and namespaces

2012-08-10 Thread Jaidev Deshpande
Hi, Supposed I have a string containing a python script and I exec that script. Is there a way to keep track of the variables that this exec() command creates? Say, >>> s = 'for i in range(10):\n\tprint i\n\n' >>> exec(s) 0 1 2 3 4 5 6 7 8 9 Is there a way to ascertain that the variable 'i' wa