Dear All,
I want build a data structure to store limited undo buffer, take store 6 dict data for example with below pseudocode:
rawdict1 = {1}
buffer = [{1}]
rawdict1 = {2}
buffer = [{2}{1}] # {1} stored on the postion
rawdict1 = {3}
buffer = [{3}{2}{1}]
...
rawdict1 = {5}
buffer = [{5}{4}{3}{2}{1}] # max length limited to 5
rawdict1 = {6}
buffer = [{6}{5}{4}{3}{2}] # {1} has been deleted because exceed the limit
when I want to restore the rawdict1 later, I can use something looks like:
rawdict1 = buffer[5] # restore the 5th dict.
My question is, can existing buildin data type or standard library type can be used for such a purpose?
And is it possible such a structure can store multi-types in one structure instance, say, if I want to store dict and self-defined class in one go?
Thanks!
Rgs,
KC