Variables
Kent Johnson
kent37 at tds.net
Sat Apr 23 23:24:07 EDT 2005
Richard Blackwood wrote:
>>> To All:
>>>
>>> Folks, I need your help. I have a friend who claims that if I write:
>>>
>>> foo = 5
>>>
>>> then foo is NOT a variable, necessarily.
>>
> Indeed, this language is math. My friend says that foo is a constant and
> necessarily not a variable.
Well, we mostly talk Python here, not math. In Python, if you say
foo = 5
foo is a name bound to an immutable value.
If I had written foo = raw_input(), he would
> say that foo is a variable.
That's funny. foo is still a name bound to an immutable (string) value. foo is no more or less
variable than it was with foo = 5.
Which is perfectly fine except that he
> insists that since programming came from math, the concept of variable
> is necessarily the identical. This can not be true. For example, I may
> define foo as being a dictionary, but I can not do this within math
> because there is no concept of dictionaries within mathematics; yet foo
> is a variable, a name bound to a value which can change.
Sounds like you are having a stupid and meaningless argument with your friend. What you call foo
won't change what it is. He should learn Python, then he would understand the true zen of foo.
Kent
More information about the Python-list
mailing list