I am new to data structures in python and was wondering how do you simulate a thing like pointers in python so that multiple structures can refer and manage the same piece of da
Simply put, there is no way to easily link your two structures.
You could manipulate the object you point to so that it has some "deleted" state and would act as if it's deleted (while being in both containers).
However, if all you wanted was a list
from a dict
, use list(the_dict.values())
.
You could make a class to achieve this, if all else fails. See https://docs.python.org/2/reference/datamodel.html#emulating-container-types for the details on what your class would have to have. Within the class, you would have your "duplicated effort," but if it's correctly implemented it wouldn't be error prone.