List Problem

Chris Angelico rosuav at gmail.com
Sun Sep 23 21:52:22 EDT 2012


On Mon, Sep 24, 2012 at 10:56 AM, Littlefield, Tyler
<tyler at tysdomain.com> wrote:
> I've not been following this thread fully, but why not just use x=list(y) to
> copy the list?
> The issue is that when you assign i=[1,2,3] and then j = i, j is just a
> reference to i, which is why you change either and the other changes.

The problem is with lists as elements of that list, so the key is deepcopy.

ChrisA



More information about the Python-list mailing list