Looking up a dictionary _key_ by key?

Dan Stromberg drsalists at gmail.com
Tue Jun 23 20:21:55 EDT 2015


I know that sounds strange: usually we look up values by key, not keys.

But suppose you have a strange key type that despite being "equal", is
not identical in some fields, and you need to see those fields.

Is there a way of getting the key used by the dictionary, short of
storing a reference to it in the value, or using a second dictionary?

Thanks!



More information about the Python-list mailing list