I have a long list of states, which are traversed in order. Traversing a state means a new state is generated, as a replacement for the existing state. After a small number of traversals, I conclude either success of failure. If success, then my new list is the modified states at the top of the list, and all the un-traversed elements unchanged. If I conclude failure, I just return the original list. That is, I 'undo' by throwing away the changes.
The success case could be done by concatenating my list of new states with a slice of the original list. However, slices do shallow copies if I understand correctly. It seems this is an unnecessary cost for a long list. If I had a linked list, I could do this at very low cost, I think.
Should I implement this as a linked list in python? [because if the list needs to be modified, the elements at the head of the list can simply be added to the unmodified tail by changing a pointer, no O(N) copying of the list, which is unavoidable with Python lists]
EDIT Iterators seem to be a good Python solution. See my answer below. Apparently, this requirement is a 'retroactive data structure'