Re: List semantics [was Re: Slices time complexity]

2015-05-20 Thread Steven D'Aprano
On Wed, 20 May 2015 06:54 pm, Gregory Ewing wrote: > Steven D'Aprano wrote: > >> Code snippet 1: >> >> x = [[1,2],[1,2]] >> >> creates a list bound to the name "x", containing a list containing ints 1 >> and 2, and a second independent list also containing ints 1 and 2. > > Using the word

Re: List semantics [was Re: Slices time complexity]

2015-05-20 Thread Gregory Ewing
Terry Reedy wrote: A club roster contains identifiers that refer to and identify the members. Exactly: the roster "refers to" the members, rather than "containing" them. Or equivalently, it contains references to the members. -- Greg -- https://mail.python.org/mailman/listinfo/python-list

Re: List semantics [was Re: Slices time complexity]

2015-05-20 Thread Terry Reedy
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 c

Re: List semantics [was Re: Slices time complexity]

2015-05-20 Thread Gregory Ewing
Steven D'Aprano wrote: Code snippet 1: x = [[1,2],[1,2]] creates a list bound to the name "x", containing a list containing ints 1 and 2, and a second independent list also containing ints 1 and 2. Using the word "contains" here is misleading, because it conjures a mental picture of phy

List semantics [was Re: Slices time complexity]

2015-05-20 Thread Steven D'Aprano
On Wednesday 20 May 2015 16:23, Rustom Mody wrote: > I dont like teaching this. viz that in python > x = [[1,2],[1,2]] > is equal to y defined as > z = [1,2] > y = [z,z] > And although they are equal as in '==' they are not equal as in behavior, > memory usage etc, a fact that can only be elucidat