Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #93052

Looking up a dictionary _key_ by key?

Date 2015-06-23 17:21 -0700
Subject Looking up a dictionary _key_ by key?
From Dan Stromberg <drsalists@gmail.com>
Newsgroups comp.lang.python
Message-ID <mailman.0.1435105323.3674.python-list@python.org> (permalink)

Show all headers | View raw


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!

Back to comp.lang.python | Previous | NextNext in thread | Find similar | Unroll thread


Thread

Looking up a dictionary _key_ by key? Dan Stromberg <drsalists@gmail.com> - 2015-06-23 17:21 -0700
  Re: Looking up a dictionary _key_ by key? Paul Rubin <no.email@nospam.invalid> - 2015-06-23 18:02 -0700
  Re: Looking up a dictionary _key_ by key? Steven D'Aprano <steve@pearwood.info> - 2015-06-24 11:49 +1000

csiph-web