Explanation of list reference

Marko Rauhamaa marko at pacujo.net
Sat Feb 15 04:00:46 EST 2014


Ned Batchelder <ned at nedbatchelder.com>:

> On 2/14/14 4:43 PM, Marko Rauhamaa wrote:
> Yes, sometimes for teaching reasons, you have to over-simplify or even
> introduce artificial constructs.  I'd recommend acknowledging them as
> such.
>
> When you say, "There are two fundamentally different kinds of values
> in Python," or "So we have four kinds of (memory) slots," you aren't
> letting on that this is a teaching construct. It sounds like you mean
> that this is how Python actually works.
>
> I'd use words like, "This is an oversimplification, but might
> help...", or "You can think of it like ...".

Strictly speaking, I'm not simplifying, but giving an equivalent,
alternative description. I admit that the word "fundamentally" was a bad
choice. I'm not even sure my description was a good illustration. I
definitely was not referring to CPython and was trying to keep the
discussion separate from the implementation of the day.

BTW, I also wasn't oversimplifying, but complicating by bringing in an
unnecessary dichotomy. The challenge is how to present Python's value
model in the most digestible way. For example, how is a beginnger to
understand what's going on in:

   n += 1

Is it easier to think that the number held by the variable n is
incremented by 1, or is it easier to understand it orthodoxly through
instantiations and references?


Marko



More information about the Python-list mailing list