The “does Python have variables?” debate

Marko Rauhamaa marko at pacujo.net
Thu May 8 05:43:29 EDT 2014


Ben Finney <ben at benfinney.id.au>:

> The concern is that the term “variable”'s existing baggage in the
> programming community encourages *false inferences* that a beginner
> doesn't even realise they're drawing. By discouraging use of that term
> and replacing it with “name binding” or “reference”, a more accurate
> model is implied, to the extent that its existing baggage encourages
> significantly fewer false inferences.

I don't think flogging the beginner for talking about variables helps
them get Python's data model. All that accomplishes is that they will
shut up about variables in the fear of being flogged and not understand
the data model any better.

Any C programmer will get Python easily because they are familiar with
malloc() and pointers. You will have more trouble with the beginner who
has no prior programming knowledge. Do you first have to drag them along
the keel by teaching them C and them graduating them to higher-level
programming languages?

Back to the topic of variables. IMO the crucial factor that makes
Python's variables ordinary, prosaic, programming language variables is
the assignment. A real "non-variable" name-value binding would be
permanent. Lisp without setq (or scheme without set!) would be such a
language; in fact, the implementation would then not have anything
resembling variables on the inside. It's the resettability that makes a
variable a mundane memory slot, whether you have access to its address
or not.

(BTW, in lambda calculus and predicate logic, the names cannot be
rebound, but they are still called variables.)


Marko



More information about the Python-list mailing list