Re: LEGB rule, totally confused ...

2007-08-14 Thread Diez B. Roggisch
> Thanks guys, I beginning to see the light again, > and if X is mutual the story is completely different, > I still have to get used to these differences. That's supposed to be "mutable", not "mutual". Diez -- http://mail.python.org/mailman/listinfo/python-list

Re: LEGB rule, totally confused ...

2007-08-14 Thread stef mientki
Sion Arrowsmith wrote: > stef mientki <[EMAIL PROTECTED]> wrote: > >>def Run (): >>print X <=== UnboundLocalError: local variable >>'X' referenced before assignment >>X = X + 1 >> >> Why do I get the error ? >> Printing isn't assigning anything or am I mi

Re: LEGB rule, totally confused ...

2007-08-14 Thread Sion Arrowsmith
stef mientki <[EMAIL PROTECTED]> wrote: >def Run (): >print X <=== UnboundLocalError: local variable >'X' referenced before assignment >X = X + 1 > >Why do I get the error ? >Printing isn't assigning anything or am I missing something. >Now if I remove "X =

Re: LEGB rule, totally confused ...

2007-08-14 Thread Neil Cerutti
On 2007-08-14, stef mientki <[EMAIL PROTECTED]> wrote: > I've thought many times I finally understood the import / > namespace rules, but again I'm totally lost :-( > > This is my library file > > # Module lib_test.py > > X = 1 > > def Init(): > global X > X = 3 >

Re: LEGB rule, totally confused ...

2007-08-14 Thread Laurent Pointal
stef mientki a écrit : > hello, > > I've thought many times I finally understood the import / namespace rules, > but again I'm totally lost :-( > > This is my library file > ># Module lib_test.py > >X = 1 > >def Init(): >global X >X = 3 >print 'Init', X > >

Re: LEGB rule, totally confused ...

2007-08-14 Thread Diez B. Roggisch
stef mientki wrote: > hello, > > I've thought many times I finally understood the import / namespace rules, > but again I'm totally lost :-( > > This is my library file > > # Module lib_test.py > > X = 1 > > def Init(): > global X > X = 3 > print 'Init', X