On Fri, Nov 20, 2015 at 5:50 AM, BartC <b...@freeuk.com> wrote: > But you're not going to tell me what it is I got wrong! > > I said that Python's "=" does a very shallow copy. And I stated that in A=B, > something of B must be copied into A. > > I (and probably others) would like to know why none of that is correct. But > I suspect I'm not wrong.
There's no copying happening. You evaluate the expression `B`, and get back some kind of object (because all expressions in Python evaluate to objects, unless they raise exceptions or in some way don't finish evaluating). The name A then becomes bound to that object. You're not copying a reference; you're simply referencing the result of an expression. PLEASE finish reading Ned's talk. Here's the link again: http://nedbatchelder.com/text/names1.html It is an excellent explanation of the exact points you're confused about. ChrisA -- https://mail.python.org/mailman/listinfo/python-list