Global confusion
Gaetan Corneau
Gaetan_Corneau at baan.com
Wed Sep 29 07:49:27 EDT 1999
Guys,
David Ascher wrote:
> The problem is that because nbPar is *assigned to* in the function body
[...]
I'm sorry I asked the question. I was thinking about it yesterday night
while driving home, and found the answer.
I often use globals, but never change their values :)
Thank you for the explanations, now I understand the mechanism.
John Skaller wrote:
> class X(): pass
> x = X()
> def f(y):
> x.y =1 # assign to attribute of global instance
Interesting. I won't ask why this works, but it might come handy.
Thanks,
______________________________________________________
Gaetan Corneau
Software Developer (System Integration Team)
BaaN Supply Chain Solutions
E-mail: Gaetan_Corneau at baan.com
Compuserve: Gaetan_Corneau at compuserve.com
ICQ Number: 7395494
Tel: (418) 266-8252
______________________________________________________
"Profanity is the one language all programmers know best"
More information about the Python-list
mailing list