On Tue, 18 Sep 2012 21:38:19 -0400, Terry Reedy wrote:
> On 9/18/2012 5:51 PM, Thomas Jollans wrote:
>> On 09/18/2012 10:50 PM, weissman.m...@gmail.com wrote:
>>> Well there's wired stuff like this:
>>>
>>> In [1]: locals()["x"] = 5
>>>
>>> In [2]: print x
>>> 5
>>>
>>>
>> No, there isn't. Modifyi
On 9/18/2012 5:51 PM, Thomas Jollans wrote:
On 09/18/2012 10:50 PM, weissman.m...@gmail.com wrote:
Well there's wired stuff like this:
In [1]: locals()["x"] = 5
In [2]: print x
5
No, there isn't. Modifying the dictionary returned by locals() has no
effect.
Last time I tried it, it does wi
On 18/09/2012 21:10, porkfried wrote:
I want to define a 'with' command that makes entries
in dictionary available within the local scope, and
stores new local variables into that dictionary. The
original scope should be restored on exit, and called
functions should not see anything special. Ca
On 09/18/2012 10:50 PM, weissman.m...@gmail.com wrote:
> Well there's wired stuff like this:
>
> In [1]: locals()["x"] = 5
>
> In [2]: print x
> 5
>
No, there isn't. Modifying the dictionary returned by locals() has no
effect.
>>> def f ():
... locals()["x"] = 1
... return x
...
>>> f
On Tuesday, September 18, 2012 4:10:32 PM UTC-4, porkfried wrote:
> I want to define a 'with' command that makes entries
>
> in dictionary available within the local scope, and
>
> stores new local variables into that dictionary. The
>
> original scope should be restored on exit, and called
>
On 09/18/2012 10:10 PM, porkfried wrote:
> I want to define a 'with' command that makes entries
> in dictionary available within the local scope, and
> stores new local variables into that dictionary. The
> original scope should be restored on exit, and called
> functions should not see anything s
I want to define a 'with' command that makes entries
in dictionary available within the local scope, and
stores new local variables into that dictionary. The
original scope should be restored on exit, and called
functions should not see anything special. Can I do this?
my_dict = dict(a=1, b=2)
w