On Wed, 28 Dec 2005 14:40:45 -0800, "Carl J. Van Arsdall" <[EMAIL PROTECTED]> wrote: >KraftDiner wrote: >> I understand that everything in python is a refrence.... >> >> I have a small problem.. >> >> I have a list and want to make a copy of it and add an element to the >> end of the new list, >> but keep the original intact.... >> >> so: >> tmp = myList >> > >tmp = myList is a shallow copy >
"tmp = myList" isn't a copy at all. A shallow copy is like this: tmp = myList[:] or like this: import copy tmp = copy.copy(myList) This is as opposed to a deep copy, which is like this: import copy tmp = copy.deepcopy(myList) What "tmp = myList" does is to create a new *reference* to the very same list object. Jean-Paul -- http://mail.python.org/mailman/listinfo/python-list