On Tue, 28 Feb 2012 22:36:56 +1100, Ben Finney wrote: > Steven D'Aprano <steve+comp.lang.pyt...@pearwood.info> writes: > >> On Sun, 26 Feb 2012 19:47:49 +1100, Ben Finney wrote: >> >> >> An integer variable is a variable holding an integer. A string >> >> variable is a variable holding a string. A list variable is a >> >> variable holding a list. >> > >> > And Python has none of those. Its references don't “hold” anything. >> >> Ah, but they do. Following the name binding: >> >> x = 1 >> >> the name "x" now holds a reference to an int, or if you want to cut out >> one layer of indirection, the name "x" holds an int. That is to say, >> the value associated with the name "x" is an int. > > Names don't hold anything. Not in natural language, and not in Python.
I don't agree, I think the analogy of "holding on to", or "holding", works well for names in this context. A *binding* (the term you prefer) refers to the process of *tying* two objects together with rope, string, or twine such that they *hold fast*. If names don't hold values, neither can they be bound. I would be surprised if many programmers, whether experienced or not, or even non-programmers, failed to grasp the concept of a name "holding" a value. (And I point out that to *grasp a concept* is also to hold on to it. We hold our loved ones dear even when they are on the other side of the world, we hold these truths to be self-evident, and we don't hold with that sort of behaviour -- surely we are capable of holding onto the idea that names can hold values?) But rather than spend any more time trying to convince you to hold a different opinion, I will accept your criticism and rephrase my earlier statement: A string variable is a symbolic identifier given to a value and capable of being varied, which is given to a value which is a string. Python has these -- it has names, which are symbolic identifiers given to values, and those name:value bindings are capable of varying. It has strings. And you can bind names to strings. Ergo, it has string variables. I acknowledge that when I say "string variable", I mean a variable whose value is a string *at this moment*, I don't mean a variable which is prohibited by the compiler from taking a non-string value. To the extent that careless use of the term variable may confuse the naive reader who assumes that Python is just like Pascal (or any other statically typed language), it is sometimes useful to emphasis the differences by talking about "name bindings". But sometimes it is useful to emphasis the similarities, in which case "name binding" is obfuscatory and "variable" is perfectly reasonable. -- Steven -- http://mail.python.org/mailman/listinfo/python-list