List Problem

Chris Angelico rosuav at gmail.com
Sun Sep 23 18:30:33 EDT 2012


On Mon, Sep 24, 2012 at 8:27 AM, Chris Angelico <rosuav at gmail.com> wrote:
> a = [[1, 2, 3], [4, 5, 6], [7, 8, 9]]
> b = deepcopy(a) # b is a new list with three new sublists
>

Oops, this should be:

b = copy.deepcopy(a)

as in Steven's post. And in case I wasn't clear about it, the
deepcopy() function does deal with the issue I mention, but that's
part of why it's an expensive operation.

ChrisA



More information about the Python-list mailing list