def splice(self, data=None): data = [] if data is None else data assert isinstance(data, list) assert isinstance(self.struct[self.index], list) removed = self.struct[self.index][self.start : self.stop] self.struct[self.index][self.start : self.stop] = data proxy.reproxy_list(self.struct.proxy, self.index, self.struct[self.index]) self.stop = self.start + len(data) return removed
def replace(self, obj=None): removed = self.struct[self.list_index][self.index] if obj is not None: self.struct[self.list_index][self.index] = obj proxy.reproxy_list(self.struct.proxy, self.list_index, [obj], self.index) return removed