Variables
Ron
radam2 at tampabay.rr.com
Sun Apr 24 01:32:51 EDT 2005
Richard Blackwood wrote:
> He would argue strongly against your notion of variable. In the
> statement "foo = 5", foo is constant. He would thus argue that foo is a
> constant and not a variable (regardless of whether you change foo's
> value in subsequent statements).
Sounds like his mind is made up and you will probably not be able to
persuade him otherwise.
But maybe this will help... or not. ;-)
Given a math equation...
x = 2y+3
x and y are clearly (most would agree) variables. The value of each
changes depending on the value of the other.
To solve the equation you set one variable to a value to find the other.
x = 2*y+3
y = 5
x = 2*5+3
x = 13
Do this again for other values... etc...
Would he agree that x, and y are variables even after a value is
determined? Or would he say that they become constants once you decide
a value for one?
I think context is the deciding factor if this is a general discussion
concerning math equations. The above equation may be an equation of a
line, or it may be the equation of a specific condition with two unknowns.
They may variables which may either have the value which is constant, a
known value, an unknown value, or a range of values.
So given only "foo = 5" ...
In Python foo is a Name which is bound to the integer 5. There are
other way to describe it, but it all comes down to being symbols
representing a concept.
(It could have been a randomly generated sequence with no meaning at all
too!)
Without knowing the context of the discussion, that is all that we can
say. However if we were to agree that foo represents a concept that has
an unchanging value in the context that it is used, then it is a
constant, because we agreed that it is. So it is determined by the
meaning we agree (or decide for ourself) to give to the name "foo".
So what is the meaning of foo? In general computer discussions foo is
ever changing and represents an abstract object to be used and reused to
describe a multitude of possibilities. I would call that a variable.
;-)
Cheers,
Ron
More information about the Python-list
mailing list