On Mon, 30 Sep 2013 19:47:49 -0400, Ned Batchelder wrote: > On 9/30/13 6:37 PM, Ben Finney wrote: >> Ethan Furman <et...@stoneleaf.us> writes: >> >>> From [Ned Batchelder]'s blog: >>>> Names are Python's variables: they refer to values, and >>>> those values can change (vary) over the course of your program. >>> This is partially incorrect. If the value referred to by the name is >>> immutable, then it cannot change; perhaps you meant to say that which >>> object the name points to can vary over time? >> I agree. Names are not Python's variables. >> >> If anything in Python is a “variable” as generally understood, it is >> not a name. It is a *binding*, from a reference (a name, or some other >> reference like a list item) to a value. >> >> It is the binding which can change over the course of the program, so >> that is the variable. >> >> > True, but no one calls the binding the variable. Here is a program: > > x = 4 > > Every one of us is perfectly comfortable talking about the variable x. > Don't get hung up on implementation pedantry. The name x here refers to > 4. Later it could refer to "four". The value associated with the name > x changed. x is a variable.
Your statement is ambiguous -- do you mean the *association* between value (object) and name changed, or the value which is associated with the name changed? In the first case, "the value associated with the name x changed" is no different from saying "the name binding changed", only longer and more ambiguous. In the second case, if you mean that the association remains the same, but the value itself changed, that's demonstrably untrue since 4 is immutable. But you know that :-) I straddle the fence on this dispute... I'll often refer to Python variables when, in my option, it doesn't confuse the issue or introduce ambiguity, but I feel guilty doing so :-) And I always look for the opportunity to introduce the concept of name binding into the discussion. I'm just not religious about it. -- Steven -- https://mail.python.org/mailman/listinfo/python-list