On 05/08/2014 07:03 AM, Marko Rauhamaa wrote:
Ethan Furman <et...@stoneleaf.us>:
On 05/08/2014 05:41 AM, Roy Smith wrote:

For those people, talking about variables as a container to hold a
value is the right level of abstraction.

Teaching someone that Python variables are containers is a massive fail.

But that's what they are.

No, it's not.


We are really debating on the suitability of a metaphor.

Exactly. And the "a variable is a box that holds the value" is a great metaphor for languages that assign a name to a fixed location -- languages such as Pascal, Basic, FoxPro, and C. In these languages when you say `a = b` you now have *two* copies of the data (at least for the most part); in Python (and similar languages) you have two *names* for one copy of the data.


Or maybe we can think of Python's data model as a city with structures
of different sizes and shapes. A variable is a container that holds the
address of a structure...

If that helps as a stepping stone to a true model, fine; but if that's the final destination of your understanding then you don't truly understand Python's data model.

--
~Ethan~
--
https://mail.python.org/mailman/listinfo/python-list

Reply via email to