From: Jesse [EMAIL PROTECTED]
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
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
Try:
##
print 2, timestwo(2)
print 3, timestwo(3)
##
..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
Why is it that when one variable is assigned a value in terms of another variable, assigning a new value to the first doesn't change the value of the second? This is giving me a huge headache, since I have a bunch of variables defined in terms of one another, and I want to be able to dynamically
On Fri, 7 Apr 2006, Jesse wrote:
Why is it that when one variable is assigned a value in terms of another
variable, assigning a new value to the first doesn't change the value of
the second?
Hi Jesse,
If you have a variable that depends on the values of other parameters,
that's just
Jesse wrote:
Why is it that when one variable is assigned a value in terms of
another variable, assigning a new value to the first doesn't change
the value of the second? This is giving me a huge headache, since I
have a bunch of variables defined in terms of one another, and I want
to be
-- 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