How to deepcopy a list of user defined lists?

srinivasan srinivas sri_annauni at
Thu Jan 8 08:59:37 CET 2009

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)
        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.


      Add more friends to your messenger and enjoy! Go to

More information about the Python-list mailing list