What other languages use the same data model as Python?

Ben Finney ben+python at benfinney.id.au
Sat May 7 21:16:40 EDT 2011


Gregory Ewing <greg.ewing at canterbury.ac.nz> writes:

> Ben Finney wrote:
>
> > No, I think not. The term “variable” usually comes with a strong
> > expectation that every variable has exactly one name.
>
> I would say that many variables don't have names *at all*, unless you
> consider an expression such as a[i] to be a "name".

Again, our disagreement is not over the behaviour of Python, but over
what an average newcomer to Python can be expected to understand by the
term “variable” from its usage elsewhere in programming.

> What would *you* call a[i]?

What *I* would call that isn't relevant to the point. I do think it's
even more misleading to call that “a variable”, though, since it's not
what the Python docs call a variable and it's not what an average
newcomer would call a variable.

It's a reference. So is ‘a’, so is ‘i’; names are a special kind of
reference. In Python, references are how we get at objects within our
code, and names are one kind of reference.

-- 
 \      “Not using Microsoft products is like being a non-smoker 40 or |
  `\     50 years ago: You can choose not to smoke, yourself, but it's |
_o__)               hard to avoid second-hand smoke.” —Michael Tiemann |
Ben Finney



More information about the Python-list mailing list