nested structure with "internal references"

Torsten Mohr tmohr at
Fri Sep 25 19:11:06 CEST 2009


sorry for posting in german before, that was a mistake.

I'd like to use a nested structure in memory that consists
of dict()s and list()s, list entries can be dict()s, other list()s,
dict entries can be list()s or other dict()s.

The lists and dicts can also contain int, float, string, ...

But i'd also like to have something like a "reference" to another
I'd like to refer to another entry and not copy that entry, i need to
know later that this is a reference to another entry, i need to find
also access that entry then.

Is something like this possible in Python?

The references only need to refer to entries in this structure.
The lists may change at runtime (entries removed / added), so
storing the index may not help.

Thanks for any hints,

More information about the Python-list mailing list