On 5/20/2015 4:54 AM, Gregory Ewing wrote:

At this point the student thinks, "Um... what? How
can an object contain another object *twice*?"
If he's still thinking in physical terms, this
sentence is nonsensical.

It gets even worse with:

x = [1, 2]
x[1] = x

Now you have to say that the list contains *itself*
in some weird Tardis-like fashion!

I can't think of any way to dispel the confusion
verbally without using some word like "reference"
or "pointer" or something with an equivalent meaning.
Something that suggests a level of indirectness.

Python sets and lists (and frozen versions) are like clubs. A club roster contains identifiers that refer to and identify the members. Kids who can read and write names usually have no problem with this. The roster for the Recursive Club (of recursive clubs) would contain the identifier 'Recursive Club'.

--
Terry Jan Reedy

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

Reply via email to