def ismember(self, obj): if type(obj) in [set, tuple, list]: for i in obj: if type(i) == pairing: if ismember(self.Pairing, i) == False: return False return True elif type(obj) == dict: for i in obj.keys(): if type(i) == pairing: if ismember(self.Pairing, obj[i]) == False: return False return True else: if type(obj) == pairing: return ismember(self.Pairing, obj) return None # ignore non-pairing types
def ismemberDict(self, obj): """membership test for a dict of pairing objects""" for i in obj.keys(): if not ismember(self.Pairing, obj[i]): return False return True
def ismemberList(self, obj): """membership test for a list of pairing objects""" for i in range(len(obj)): if not ismember(self.Pairing, obj[i]): return False return True
def ismember(self, obj): """membership test for a pairing object""" return ismember(self.Pairing, obj)
def ismemberDict(self, obj): """membership test for a dict of pairing objects""" for i in obj.keys(): if ismember(self.Pairing, obj[i]) == False: return False return True
def ismemberList(self, obj): """membership test for a list of pairing objects""" for i in range(len(obj)): if ismember(self.Pairing, obj[i]) == False: return False return True