En Fri, 11 Jul 2008 03:51:39 -0300, Uwe Schmitt
<[EMAIL PROTECTED]> escribi�:
On 1 Jul., 15:15, Mel <[EMAIL PROTECTED]> wrote:
rocksportrockerwrote:
> the following code does not work until I ommit the "a=0" statement.
> def test():
> exec "a=3" in locals()
> print a
>
Uwe Schmitt wrote:
>> Apparently, exec in locals() knows nothing about slots (because locals()
>> is the only dictionary in the universe where slots would be involved ? --
>> perhaps not, but close).
>>
>> Mel.
>
> Thanks for your answer. I wonder if this is a bug, or did I miss
> something in th
On 1 Jul., 15:15, Mel <[EMAIL PROTECTED]> wrote:
> rocksportrockerwrote:
>
> > Hi,
>
> > the following code does not work until I ommit the "a=0" statement.
>
> > def test():
> > exec "a=3" in locals()
> > print a
> > a=0
>
> > test()
>
> > print raises:
> > Unbound
rocksportrocker wrote:
>
> Hi,
>
> the following code does not work until I ommit the "a=0" statement.
>
>
>def test():
>exec "a=3" in locals()
>print a
>a=0
>
> test()
>
> print raises:
> UnboundLocalError: local variable 'a' referenced before
> assignme
Hi,
the following code does not work until I ommit the "a=0" statement.
def test():
exec "a=3" in locals()
print a
a=0
test()
print raises:
UnboundLocalError: local variable 'a' referenced before
assignment
Can anybody explain what is going wrong here ?
Gree