def move(self, args): """Move an item in the list to another space""" from_idx = validators.parse_index(self, args[0]) to_idx = validators.parse_index(self, args[1]) if from_idx == to_idx: raise errors.SameItemError self.items[from_idx], self.items[to_idx] = self.items[to_idx], self.items[from_idx] self.mark_dirty()
def replace(self, args): """Replace an item in the list""" text = args[1:] idx = validators.parse_index(self, args[0]) self.items[idx] = ' '.join(text) self.mark_dirty()
def delete(self, args): """Delete an item from the list""" idx = validators.parse_index(self, args[0]) self.items.pop(idx) self.mark_dirty()