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


Groups > comp.lang.python > #93052

Looking up a dictionary _key_ by key?

Path csiph.com!optima2.xanadu-bbs.net!xanadu-bbs.net!feeder.erje.net!1.eu.feeder.erje.net!feeds.phibee-telecom.net!newsfeed.xs4all.nl!newsfeed7.news.xs4all.nl!post.news.xs4all.nl!not-for-mail
Return-Path <drsalists@gmail.com>
X-Original-To python-list@python.org
Delivered-To python-list@mail.python.org
X-Spam-Status OK 0.048
X-Spam-Evidence '*H*': 0.90; '*S*': 0.00; 'value,': 0.03; 'dictionary,': 0.16; 'keys.': 0.16; 'storing': 0.16; 'subject:key': 0.16; 'to:name:python list': 0.16; 'suppose': 0.22; 'second': 0.24; 'message-id:@mail.gmail.com': 0.28; 'key,': 0.29; 'values': 0.30; 'getting': 0.33; 'usually': 0.33; 'thanks!': 0.34; 'subject:?': 0.34; 'received:google.com': 0.34; 'to:addr:python- list': 0.35; 'but': 0.36; 'being': 0.36; 'there': 0.36; 'to:addr:python.org': 0.39; 'some': 0.40; 'strange': 0.63; 'sounds': 0.72; 'fields,': 0.84
DKIM-Signature v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:date:message-id:subject:from:to:content-type; bh=0sPoziJNDovGsNCsJUPnDSu5L14YmYX13XhrMriroNk=; b=KSUX+PzW3HdugMlG54wZBZxAHdSqMy3SWHD+ewKEbAnchPRti8S00wsPBBvVnpnSLW DJ4cSnJy+ZU5xzFA4BO/Yr4JkEWsiBqTsPa96smtNWn46BUSddUhvnMeR0xt4uMjXmwj 3xY01snV+96ZdgnLSFIQfBQPcjD+wfo7511fKV52y3itpsRV16Ys9qAuLeLVWCHwLwFe VU7+1KbXZaPelKMxnrKE5lEL8Z4QlT8LLhOiVzX9VaHlVhgo8sC+g3fO67yHdykB8D2S n1ohwiK2ia1OSeCkFBN37eysfeMU6JWnhQbHyYpVHoAN2dJAB6cCbgUsNjE8A7uxHCxz qm/w==
MIME-Version 1.0
X-Received by 10.55.18.14 with SMTP id c14mr50414234qkh.51.1435105315195; Tue, 23 Jun 2015 17:21:55 -0700 (PDT)
Date Tue, 23 Jun 2015 17:21:55 -0700
Subject Looking up a dictionary _key_ by key?
From Dan Stromberg <drsalists@gmail.com>
To Python List <python-list@python.org>
Content-Type text/plain; charset=UTF-8
X-BeenThere python-list@python.org
X-Mailman-Version 2.1.20+
Precedence list
List-Id General discussion list for the Python programming language <python-list.python.org>
List-Unsubscribe <https://mail.python.org/mailman/options/python-list>, <mailto:python-list-request@python.org?subject=unsubscribe>
List-Archive <http://mail.python.org/pipermail/python-list/>
List-Post <mailto:python-list@python.org>
List-Help <mailto:python-list-request@python.org?subject=help>
List-Subscribe <https://mail.python.org/mailman/listinfo/python-list>, <mailto:python-list-request@python.org?subject=subscribe>
Newsgroups comp.lang.python
Message-ID <mailman.0.1435105323.3674.python-list@python.org> (permalink)
Lines 9
NNTP-Posting-Host 2001:888:2000:d::a6
X-Trace 1435105323 news.xs4all.nl 2833 [2001:888:2000:d::a6]:50826
X-Complaints-To abuse@xs4all.nl
Xref csiph.com comp.lang.python:93052

Show key headers only | 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