"KraftDiner" <[EMAIL PROTECTED]> writes: > I understand that everything in python is a refrence....
Correct. > I have a small problem.. Maybenot so small. > 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.append(something) > print tmp, myList > > should be different... They won't be, because the assignment statement just binds the name on the left to the value on the right, meaning they'll both point to the same object. To get a copy, you have to make a copy. The easy way is: tmp = list(myList) However, this won't coppy the things *in* myList. If you want that you want the copy module's deepcopy function. <mike -- Mike Meyer <[EMAIL PROTECTED]> http://www.mired.org/home/mwm/ Independent WWW/Perforce/FreeBSD/Unix consultant, email for more information. -- http://mail.python.org/mailman/listinfo/python-list