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


Groups > comp.lang.python > #93055

Re: Looking up a dictionary _key_ by key?

References <CAGGBd_pd9SA7SczanGARFr-+Z9SxP9Mkhfo-RivpcJLrnuexng@mail.gmail.com> <851th2t05t.fsf@benfinney.id.au> <CAGGBd_qaNC38Yg0u_b8+qBAckq6FRTZMxbWwuzV=MUYE_=ZzDw@mail.gmail.com>
Date 2015-06-24 11:02 +1000
Subject Re: Looking up a dictionary _key_ by key?
From Chris Angelico <rosuav@gmail.com>
Newsgroups comp.lang.python
Message-ID <mailman.3.1435107726.3674.python-list@python.org> (permalink)

Show all headers | View raw


On Wed, Jun 24, 2015 at 10:47 AM, Dan Stromberg <drsalists@gmail.com> wrote:
> Would I have to do an O(n) search to find my key?

Iterate over it - it's an iterable view in Py3 - and compare.

ChrisA

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


Thread

Re: Looking up a dictionary _key_ by key? Chris Angelico <rosuav@gmail.com> - 2015-06-24 11:02 +1000
  Re: Looking up a dictionary _key_ by key? Paul Rubin <no.email@nospam.invalid> - 2015-06-23 18:06 -0700
    Re: Looking up a dictionary _key_ by key? Ian Kelly <ian.g.kelly@gmail.com> - 2015-06-24 00:50 -0600
      Re: Looking up a dictionary _key_ by key? Marko Rauhamaa <marko@pacujo.net> - 2015-06-24 09:55 +0300
    Re: Looking up a dictionary _key_ by key? Laura Creighton <lac@openend.se> - 2015-07-05 08:25 +0200

csiph-web