Re: Python3 exec locals - this must be a FAQ

2013-02-12 Thread Steven D'Aprano
Dave Angel wrote: >> Thanks for this hint which surprises me again since I thought >> locals() by itself is a copy only. >> > > (Thanks MRAB for your correction.) > > As MRAB points out, I was in error on this point.  I only tested it in > global scope.  Inside a function it doesn't seem to work

Re: Python3 exec locals - this must be a FAQ

2013-02-12 Thread Dave Angel
On 02/12/2013 10:50 AM, Terry Reedy wrote: On 2/12/2013 8:27 AM, Dave Angel wrote: On 02/12/2013 06:46 AM, Helmut Jarausch wrote: Doing _locals= locals() This merely gives you a handle of the dict returned by locals() for when you want to do more than just pass it to (for example) exec).

Re: Python3 exec locals - this must be a FAQ

2013-02-12 Thread Terry Reedy
On 2/12/2013 8:27 AM, Dave Angel wrote: On 02/12/2013 06:46 AM, Helmut Jarausch wrote: I've tried but didn't find an answer on the net. You should start with the fine manual, which is on the net as well as included with at least the Windows distribution. It has a nice index that includes a

Re: Python3 exec locals - this must be a FAQ

2013-02-12 Thread Dave Angel
On 02/12/2013 09:29 AM, Helmut Jarausch wrote: On Tue, 12 Feb 2013 08:27:41 -0500, Dave Angel wrote: On 02/12/2013 06:46 AM, Helmut Jarausch wrote: Hi, I've tried but didn't find an answer on the net. The exec function in Python modifies a copy of locals() only. How can I transfer changes in

Re: Python3 exec locals - this must be a FAQ

2013-02-12 Thread MRAB
On 2013-02-12 13:27, Dave Angel wrote: On 02/12/2013 06:46 AM, Helmut Jarausch wrote: Hi, I've tried but didn't find an answer on the net. The exec function in Python modifies a copy of locals() only. How can I transfer changes in that local copy to the locals of my function ** without ** kno

Re: Python3 exec locals - this must be a FAQ

2013-02-12 Thread Helmut Jarausch
On Tue, 12 Feb 2013 08:27:41 -0500, Dave Angel wrote: > On 02/12/2013 06:46 AM, Helmut Jarausch wrote: >> Hi, >> >> I've tried but didn't find an answer on the net. >> >> The exec function in Python modifies a copy of locals() only. >> How can I transfer changes in that local copy to the locals of

Re: Python3 exec locals - this must be a FAQ

2013-02-12 Thread Dave Angel
On 02/12/2013 06:46 AM, Helmut Jarausch wrote: Hi, I've tried but didn't find an answer on the net. The exec function in Python modifies a copy of locals() only. How can I transfer changes in that local copy to the locals of my function ** without ** knowing the names of these variables. E.g.

Python3 exec locals - this must be a FAQ

2013-02-12 Thread Helmut Jarausch
Hi, I've tried but didn't find an answer on the net. The exec function in Python modifies a copy of locals() only. How can I transfer changes in that local copy to the locals of my function ** without ** knowing the names of these variables. E.g. I have a lot of local names. Doing _locals= l