On Sun, 4 Dec 2005, RaeNye wrote:

> Alas, the *concept* of reference is common to the human mind and human
> language!

so your initial claim of being able to explain the examples without using
references, is false.

so we now agree that we need to teach two concepts: names and references.

now comes the next issue:

you can change a list.
you can't change a number.
you can't change a string.
you can't change a tuple.

in order to explain this, i will use the 'mutable' Vs. 'immutable' issue.

do you have a way to aovid that?

the rest of what you write is not realy important, except for one point
that i will emphasize:

> Why don't you complain about the following line of code?
> >>> a = [1, 1]
> It shows the exact same "problem" - how can the number 1 appear twice in the
> same list?

when a person thinks about the number '1', they do NOT think of it as an
object. thus, they are not surprised to see it used twice in a list. the
concept that even a single number is an object is not something natural -
you don't think of "1+2" as "1.add(2)" (i.e. as an operation of 'add 2' on
the object '1'). you just think of the operationg of adding `1 and 2
together. you only consider it when you learn about languages such as
smalltalk (which started this "everything is an object" concept. in
smalltalk there are no operators. in order to perform addition, you write
something like:

[1 add: 2]

(i.e. send the message 'add:' to the object '1', supplying the object '2'
as a parameter).

since python is not pure about the syntax, we don't need to be pure about
explaining things.

> Surely you wouldn't even consider the thought that these are different
> "instances" of the number 1 (although this might be true in other
> programming languages);

actually - this is exactly what i wold have thought before being taught
programming - that you can use the number 1 here, and there, and i'd not
even bother thinking that they are the same '1'.

> Your concept of what a list /is/ should be ready to accept an object
> appearing as multiple elements in it.

in other words - references. that's what i wanted to show in the first
place - thanks for helping ;)

> I don't say the concept of reference is avoidable. I only refuse to present
> it as a special thing.

when you teach programming - everything must be explicit. what you think
is intuitive - is intuitive in a different way to different people.
avoiding talking about something does not make it clear.

-- 
guy

"For world domination - press 1,
 or dial 0, and please hold, for the creator." -- nob o. dy

לענות