How to deepcopy a list of user defined lists?
Chris Rebert
clp2 at rebertia.com
Thu Jan 8 03:26:27 EST 2009
On Wed, Jan 7, 2009 at 11:59 PM, srinivasan srinivas
<sri_annauni at yahoo.co.in> wrote:
> Hi,
> I have a class which is a subclass of builtin-type list.
>
> #------------------------------------------------------------------------------
> class clist(list):
> def __new__(cls, values, ctor):
> val = []
> for item in values:
> item = ctor(item)
> val.append(item)
>
> self = list.__new__(cls, val)
> self.__values = val
> self.__ctor = ctor
> return self
> #-----------------------------------------------------------------------------------
>
> I have a list of clists, say c1 = [clist1, clist2, clist3]
> How do i deepcopy this list? I tried using copy.deepcopy() method. But i got some errors. Please suggest me.
And those errors are? Please include a full Traceback.
Cheers,
Chris
--
Follow the path of the Iguana...
http://rebertia.com
More information about the Python-list
mailing list