Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #61553
| Path | csiph.com!usenet.pasdenom.info!weretis.net!feeder1.news.weretis.net!feeder.erje.net!eu.feeder.erje.net!xlned.com!feeder1.xlned.com!newsfeed.xs4all.nl!newsfeed1.news.xs4all.nl!xs4all!newsgate.cistron.nl!newsgate.news.xs4all.nl!post.news.xs4all.nl!not-for-mail |
|---|---|
| Return-Path | <tameritoke2@arcor.de> |
| X-Original-To | python-list@python.org |
| Delivered-To | python-list@mail.python.org |
| X-Spam-Status | OK 0.032 |
| X-Spam-Evidence | '*H*': 0.94; '*S*': 0.00; 'differently.': 0.09; 'iterate': 0.09; 'received:151': 0.09; 'subject:keys': 0.09; 'stored': 0.12; 'assumptions': 0.16; 'defined.': 0.16; 'dict': 0.16; 'entries,': 0.16; 'guessing': 0.16; 'iterating': 0.16; 'key/value': 0.16; 'objection': 0.16; 'pairs': 0.16; 'subject:values': 0.16; 'wording': 0.16; 'wrote:': 0.18; 'wed,': 0.18; 'example': 0.22; 'header:User-Agent:1': 0.23; 'received:192.168.1.100': 0.24; 'question': 0.24; 'right.': 0.26; 'task': 0.26; 'subject:/': 0.26; 'values': 0.27; 'header:In-Reply- To:1': 0.27; 'point': 0.28; "doesn't": 0.30; 'dec': 0.30; "i'm": 0.30; 'code': 0.31; 'keys': 0.31; 'could': 0.34; 'but': 0.35; 'there': 0.35; '+0200,': 0.36; 'data,': 0.36; 'next': 0.36; 'thanks': 0.36; "i'll": 0.36; 'two': 0.37; 'list': 0.37; 'starting': 0.37; 'to:addr:python-list': 0.38; 'structure': 0.39; 'to:addr:python.org': 0.39; 'dave': 0.60; 'letters': 0.60; 'entire': 0.61; 'further': 0.61; "you'll": 0.62; 'grab': 0.64; 'more': 0.64; 'effectively': 0.66; 'deeply': 0.69; '20.000': 0.84; 'ambiguous': 0.84; 'guessed': 0.84; 'absolutely': 0.87; 'angel': 0.91; '2013': 0.98 |
| X-Greylist | Passed host: 217.55.195.155 |
| X-DKIM | Sendmail DKIM Filter v2.8.2 mail-in-15.arcor-online.net E86531AB53E |
| DKIM-Signature | v=1; a=rsa-sha256; c=simple/simple; d=arcor.de; s=mail-in; t=1386756430; bh=U5fxTePdmSaMWMWXlaBj/iYf7X//Y2ezl6jehJFbrbY=; h=Message-ID:Date:From:MIME-Version:To:Subject:References: In-Reply-To:Content-Type:Content-Transfer-Encoding; b=B3ROVzbKGfsxMeAzr8aHbgjlZqJMdIwkAHWOo5Ue9YU3DUmqXeGMFnX379N+m3BLm qojccPOP5NbuYJxiy4CrX/XVLKHZviE6xi6tHFy1X5y3TVdEeHAFKl9wdiBTEsnDdH RhCyYiO4SsFF8tDpRqF+UpxSDavj3agoCswElxFQ= |
| Date | Wed, 11 Dec 2013 12:07:08 +0200 |
| From | Tamer Higazi <tameritoke2@arcor.de> |
| User-Agent | Mozilla/5.0 (X11; Linux x86_64; rv:24.0) Gecko/20100101 Thunderbird/24.1.1 |
| MIME-Version | 1.0 |
| To | python-list@python.org |
| Subject | Re: grab dict keys/values without iterating ?! |
| References | <52A7AB8C.8030700@arcor.de> <52A7AB8C.8030700@arcor.de> <almarsoft.6523303589308130554@news.gmane.org> |
| In-Reply-To | <almarsoft.6523303589308130554@news.gmane.org> |
| Content-Type | text/plain; charset=ISO-8859-1; format=flowed |
| Content-Transfer-Encoding | 7bit |
| X-Mailman-Approved-At | Wed, 11 Dec 2013 12:46:46 +0100 |
| X-BeenThere | python-list@python.org |
| X-Mailman-Version | 2.1.15 |
| 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.3885.1386762407.18130.python-list@python.org> (permalink) |
| Lines | 45 |
| NNTP-Posting-Host | 2001:888:2000:d::a6 |
| X-Trace | 1386762407 news.xs4all.nl 2892 [2001:888:2000:d::a6]:36212 |
| X-Complaints-To | abuse@xs4all.nl |
| Xref | csiph.com comp.lang.python:61553 |
Show key headers only | View raw
Hi Dave! You were absolutely right. I don't want to iterate the entire dict to get me the key/values Let us say this dict would have 20.000 entries, but I want only those with "Aa" to be grabed. Those starting with these 2 letters would be only 5 or 6 then it would take a lot of time. In which way would you prefer to store the data, and which functions or methods would you use effectively to accomplish this task ? I deeply apologize of not defining the question more defined. English is not my mother tongue. I'll do my best next time. Thanks Tamer On 11.12.2013 06:47, Dave Angel wrote: > On Wed, 11 Dec 2013 02:02:20 +0200, Tamer Higazi > <tameritoke2@arcor.de> wrote: >> Is there a way to get dict by search terms without iterating the > entire >> dictionary ?! > >> I want to grab the dict's key and values started with 'Ar'... > > Your wording is so ambiguous that each respondent has guessed > differently. > I'm guessing that you want all key/value pairs for which the key > begins with the two letters 'Ar' I'm guessing further that your > objection to iterating the entire dictionary is not code size but > performance. > If both assumptions are valid then I'll point out that a dict has no > ordering to it. If you want an approach that doesn't iterate over the > entire structure you'll need to store the data differently. For > example if you stored all the keys in a sorted list you could use bisect. >
Back to comp.lang.python | Previous | Next — Next in thread | Find similar | Unroll thread
Re: grab dict keys/values without iterating ?! Tamer Higazi <tameritoke2@arcor.de> - 2013-12-11 12:07 +0200
Re: grab dict keys/values without iterating ?! rusi <rustompmody@gmail.com> - 2013-12-11 05:31 -0800
Re: grab dict keys/values without iterating ?! Roy Smith <roy@panix.com> - 2013-12-11 09:46 -0500
Re: grab dict keys/values without iterating ?! rusi <rustompmody@gmail.com> - 2013-12-11 07:08 -0800
Re: grab dict keys/values without iterating ?! Tim Chase <python.list@tim.thechases.com> - 2013-12-11 09:42 -0600
Re: grab dict keys/values without iterating ?! Travis Griggs <travisgriggs@gmail.com> - 2013-12-11 09:19 -0800
Re: grab dict keys/values without iterating ?! Mark Lawrence <breamoreboy@yahoo.co.uk> - 2013-12-11 18:09 +0000
Re: grab dict keys/values without iterating ?! Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2013-12-11 13:44 +0000
Re: grab dict keys/values without iterating ?! Tim Chase <python.list@tim.thechases.com> - 2013-12-11 08:30 -0600
Re: grab dict keys/values without iterating ?! Ian Kelly <ian.g.kelly@gmail.com> - 2013-12-11 18:02 -0700
Re: grab dict keys/values without iterating ?! Ian Kelly <ian.g.kelly@gmail.com> - 2013-12-11 18:05 -0700
csiph-web