---------- Forwarded message ----------
Date: Fri, 7 Apr 2006 21:05:33 -0600
From: Jesse <[EMAIL PROTECTED]>
To: Danny Yoo <[EMAIL PROTECTED]>
Subject: Re: [Tutor] Beginner question (variables, namespaces...)
I tried redefining the "higher-order" variables as functions, but it didn't
quite work. Here's a simplified example:
var1 = 2
def timestwo(x):
return x*2
var2 = timestwo(var1)
print var1, var2
var1 = 3
print var1, var2
This results in the output:
2, 4
3,4
..which is not what I'm aiming for. Maybe I'll have to follow Bob's advice
and just store all of the variable assignments in a function, and then call
the function every time I change one of the variables (based on user input).
I could still leave the higher-order variables as functions as per your
advice, but that alone doesn't seem to do the trick. Unless I've missed
something.
Jesse
_______________________________________________
Tutor maillist - [email protected]
http://mail.python.org/mailman/listinfo/tutor