Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Python > dict: retrieve the original key by key

Reply
Thread Tools

dict: retrieve the original key by key

 
 
Christoph Groth
Guest
Posts: n/a
 
      05-15-2011
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

 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Re: dict: retrieve the original key by key Christoph Groth Python 5 05-16-2011 12:47 AM
How do I retrieve original text format? Moz Tunnel Computer Information 1 08-05-2009 05:01 PM
Replace Tab Key to Return Key (Enter Key) from Web Forms? M P ASP General 1 08-06-2004 08:32 AM
Retrieve lost product key. =?Utf-8?B?anls?= Microsoft Certification 1 05-04-2004 01:27 AM



Advertisments