def __setitem__(self, item, value):
        dpmf = self.dpmf
        ptrs = self._ptrs
        l = len(self)
        if isinstance(item, (int, long)):
            if item < 0:
                item += l
            if not (0 <= item < l):
                raise IndexError('Index out of range')
            if item in ptrs:
                dpmf[ptrs[item]] = value
            else:
                new_index = len(dpmf)
                ptrs[item] = new_index
                dpmf.append(value)
        else:
            raise TypeError('Bad index')
dataset/ETHPy150Open uci-cbcl/tree-hmm/gmtkParam/__init__.py/SPMF.__setitem__/original