namespace question (original) (raw)
Ben Finney ben+python at benfinney.id.au
Tue Feb 28 06:36:56 EST 2012
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Steven D'Aprano <steve+comp.lang.python at 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.
Which is exactly why the term “name” is a good one, since Python's bindings don't hold anything either. It's a reference, not a container.
I don't believe this is a troublesome concept.
Then you have a different concept of “name” from anything I'd expect anyone to understand.
> I appreciate that you think “variable” is a useful term in Python, > but this kind of mangling of the concept convinces me that it's not > worth it.
I'm not sure that there is any mangling here. Or at least, the concept is only mangled if you believe that Pascal- or C-like variables (named memory locations) are the one true definition of "variable". I do not believe this.
The fact that you keep having to come back to container analogies, when that's exactly what Python doesn't have and what differentiates it, is why I think the term “variable” isn't helping the discussion. Not for us, and not for newcomers to the language.
Words vary in their meanings
Of course they do. but we don't have to let any word mean any arbitrary thing. I reject attempts to Humpty Dumpty our way through discussions with newcomers about Python concepts.
-- \ “Simplicity and elegance are unpopular because they require | `\ hard work and discipline to achieve and education to be | o_) appreciated.” —Edsger W. Dijkstra | Ben Finney
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]