Object Reference?

Chris S. chrisks at NOSPAMudel.edu
Fri Aug 6 01:39:51 EDT 2004


I'm trying to make a graphical editor and browser for Pickled files. One 
aspect I'm not sure about is how to detect multiple references to the 
same data.

For instance, say I had the Pickled data:
a=[1,2,3]
b=[a,4,5]
c=[b,6,7]
d=[a,b,c]

The idea is to allow the user to browse this data and indicate 
references. In this case, if 'a' was selected, the browser should show 
that 'b', 'c', and 'd' contain a reference to 'a'. Inversely, if 'c' 
were selected, it should indicate that it's first element just isn't a 
list, but a reference to a list defined elsewhere, namely 'b'.

Naturally, I could just recursively parse all the data comparing every 
element to every previously listed object, but is there a less obtrusive 
method? Python figures out when to delete objects based on the remaining 
references to an object. Is there a way to access this information to 
automatically lookup these references? Any help is greatly appreciated.



More information about the Python-list mailing list