[Tutor] Global var problem
Nick Lunt
nick at javacat.f2s.com
Sat Oct 29 20:37:15 CEST 2005
Alan Gauld wrote:
>> messing about with classes I've come across something basic that I
>> don't understand.
>
>
> As you say this has nothing to do with classes its more basic. Its
> about namespaces. Try reading the namespaces topic in my tutor for
> more info.
>
> Meanwhile lets simplify by removing the class bit
>
>
> def h():
> global x
> x += 1
> print x
>
> h() # prints 43
Many thanks to Alan, Andrei, Hugo and Welsey for helping me to
understand where I was going wrong.
I thought I understood namespaces but _obviously_ not .
Thanks again,
Nick .
More information about the Tutor
mailing list