subclassing list question

manstey manstey at csu.edu.au
Sun May 20 20:43:49 EDT 2007


Hi,

I have a simple class that subclasses list:

class CaListOfObj(list):
    """ subclass of list """
    def __init__(self, *args, **kwargs):
        list.__init__(self, *args, **kwargs)

a = CaListOfObj([1,2,3])

I want an instance method to be run EVERY time a is modified. Is this
possible?

Thanks,
Matthew




More information about the Python-list mailing list