anything like C++ references?

Moshe Zadka m at moshez.org
Mon Jul 14 02:02:54 EDT 2003


On Sun, 13 Jul 2003, Stephen Horne <intentionally at blank.co.uk> wrote:

> The problem is that you are confusing implementation with semantics.
> The meanings of 'variable', 'value', 'assignment' etc are defined by
> computer science.

This is not just wrong, but as far as it is right, the semantics agree
with Python's :)
In computer science, the theoretical model one first learns is a turing
machine. Turing machines have no variables or values, merely tapes. While
I'm sure you can creatively translate the terms to turing machiens, this
exercise seems fairly pointless. Ram machines are similar. More abstract
models, like recursive functions, deal with integers only, so again you
would need hard to associate terms with them [you can implement a list
of integers with the p_1^n_1*....p_k^n_k, where p_1,...,p_k are distinct
primes. I'm not completely sure how this would translate to Python, though :)]

However, computer science did have a minor notational revolution: Lisp.
Lisp was originally invented as an abstract way to express computations
in a more natural, and yet well-defined, way. The fact that lisp can be
*implemented* was somewhat of a shock, but it turned to be a fairly useful
language.

So as far as computer science defines the idea of "variable", "value"
and "assignment", it can be said to give those terms the Lisp semantics,
which are fairly similar to Python semantics.

[Note that in Lisp conses, for example, are actually mutable. However,
many functions treat them as immutable objects. This is perfectly fine,
and was a concious design decision in Lisp. Similarily, Python wouldn't
*need* tuples: they can be implemented as lists. The immutability allows
the implementation to play tricks with memory usage, though.]

-- 
Moshe Zadka -- http://moshez.org/
Buffy: I don't like you hanging out with someone that... short.
Riley: Yeah, a lot of young people nowadays are experimenting with shortness.
Agile Programming Language -- http://www.python.org/





More information about the Python-list mailing list