Create child class of Python dict with modified values
dmitrey.kroshko at scipy.org
Mon Aug 9 12:26:04 CEST 2010
suppose I have defined a child class of Python dict, currently it
constructor looks like that:
def __init__(self, *args, **kwargs):
dict.__init__(self, *args, **kwargs)
#(+some more insufficient code)
Constructor should be capable of calling with either any way Python
dict is constructed or with a Python dict instance to be derived from;
calculations speed is important.
So it works well for now, but I want __init__ to set modified values,
values_of_the_dict = [some_func(elem) for elem in self.values()]
How this could be done?
Thank you in advance,
More information about the Python-list