Velocity Reviews

Velocity Reviews (http://www.velocityreviews.com/forums/index.php)
-   Python (http://www.velocityreviews.com/forums/f43-python.html)
-   -   dict: retrieve the original key by key (http://www.velocityreviews.com/forums/t748297-dict-retrieve-the-original-key-by-key.html)

Christoph Groth 05-15-2011 08:28 AM

dict: retrieve the original key by key
 
Dear python experts,

I use a huge python dictionary where the values are lists of that
dictionary's keys (yes, a graph). Each key is thus referenced several
times.

As the keys are rather large objects, I would like to save memory by
re-using key objects wherever possible, instead of having several equal
objects in memory.

There does not seem to be a way to retrieve the original key from a
python dictionary. Is there a technical reason for this? (Other than
that such functionality was not considered to be useful enough.)

What I will probably do now is store (key, real_value) as values in my
dictionary. Is there a better solution?

thanks,
Christoph



All times are GMT. The time now is 11:24 AM.

Powered by vBulletin®. Copyright ©2000 - 2014, vBulletin Solutions, Inc.
SEO by vBSEO ©2010, Crawlability, Inc.