def changeParentCards(self, newParentCards):
        """reshape table to have new parents with newParentCards cardinalities.
           If new mass functions are added, they are set to 0 vectors """

        if not issequence(newParentCards):
            newParentCards = [newParentCards]

        if 0 in newParentCards:
            raise ValueError("cannot have 0 cardinality in parents")

        #check if some PMs need to be deleted
        toBeDeleted=[ range(newParentCards[p], self.parentCards[p]) for p in range(min(len(newParentCards), len(self.parentCards)))]
        toBeDeleted += [ range(self.parentCards[p]) for p in range(len(newParentCards), len(self.parentCards))]

        if len(self.parentCards) < len(newParentCards):
            raise NotImplementedError("the number of parents cannot decrease.  Not implemented because reordering parents might be confusing.")

        parCards=list(self._cpars)

        for i,p in enumerate(toBeDeleted):
            parRanges = [range(j) for j in parCards]
            parRanges[i]=p
            for pmKey in cartezian(*parRanges):
                del self.table[pmKey]
            if parCards[i]>newParentCards[i]:
                parCards[i]=newParentCards[i]

        #now check if some PMs need to be added
        toBeAdded=[range(self.parentCards[p], newParentCards[p]) for p in range(min(len(newParentCards), len(self.parentCards)))]
        toBeAdded += [range(newParentCards[p]) for p in range(len(self.parentCards), len(newParentCards))]

        for i,p in enumerate(toBeAdded):
            parRanges = [range(j) for j in parCards]
            parRanges[i]=p
            for pmKey in cartezian(*parRanges):
                self.table[pmKey] = [0.] * self.selfCards[0]
            if parCards[i]<newParentCards[i]:
                parCards[i]=newParentCards[i]

        self._cpars=tuple(parCards)
dataset/ETHPy150Open uci-cbcl/tree-hmm/gmtkParam/__init__.py/DenseTable.changeParentCards/swapped operands of `<`