On Sun, 4 Dec 2005, RaeNye wrote:

> Please verify that I use the same explanation for each syntactic form (list
> constructor, __setitem__, assignment operator).
> Also, please see that I refrain from mentioning variables and references.

ok, no references, you say. now let us go directly to the 3rd example:

> Scenario 3:
> ----------------
>  >>> list1 = [1, 2]
>  >>> list2 = [3, 4]
> We create two lists, named "list1"and "list2" respectively (with the
> obvious content: the number 1 ...)
>
>  >>> mlist_a = [list1, list2]
> We create a list built of the object named "list1" and the object named
> "list2" (which are the same two lists created above). We call it "mlist_a".
>
>  >>> print mlist_a
>  [[1, 2], [3, 4]]
> Obvious.
>
>  >>> mlist_a[1] = list1
> We change the thing called "mlist_a" (which happens to be the object we
> created two sentences ago) by replacing its first element to the object
> named "list1".
> Note that now the object named "mlist_a" contains the same object as both
> the first and the seconds element: a list that consists of the number 1 and
> the number 2.

ok. an object containing the same element twice. you're using the concept
of reference, without using the word reference. to me this sounds like
breaking the rules. otherwise, how can an object contain the same object
twice? does it contain two copies of this object? or perhaps it contains 2
references to the same object?

and then what happens if i go and change list1[0] to be '3'? it changed
twice, didn't it? so the object named mlist_a actually references the
object named list1, right?

can you explain this thing without mentioning the word "reference", as
well as without using the concept "reference"?

note that i didn't even mention things like iterators, slices (which
create a new list containing references to some of the members of an
existing list), etc.

i don't see how references can be avoided (as a concept, not just by not
using the name).

-- 
guy

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

לענות