lists, performance..
Sean 'Shaleh' Perry
shalehperry at attbi.com
Thu Oct 31 10:45:33 EST 2002
On Thursday 31 October 2002 05:49, gabor wrote:
> 2. i want to insert several lists into a big list.. better to say i want
> to concatenate them... but i don't really like the 'extent' method,
> because i want to do a deep-copy... for example:
> list1 = [ ['a','b','c'], [1,2,3,4] ,[5,6,7]]
> list2 = []
> list2.extend(list1)
> but now if i modify an element in list1, list2 gets modified too..
> for now i'm doing:
>
> list1 = ...
> list2 = ...
>
> for item in list2:
> list1.append(item)
>
>>> import copy
>>> print copy.deepcopy().__doc__
Deep copy operation on arbitrary Python objects.
More information about the Python-list
mailing list