Path: csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!feeder.erje.net!eu.feeder.erje.net!newsfeed.xs4all.nl!newsfeed2.news.xs4all.nl!xs4all!post.news.xs4all.nl!not-for-mail Return-Path: X-Original-To: python-list@python.org Delivered-To: python-list@mail.python.org X-Spam-Status: OK 0.001 X-Spam-Evidence: '*H*': 1.00; '*S*': 0.00; 'read.': 0.03; 'from:addr:yahoo.co.uk': 0.04; 'favorable': 0.07; 'lawrence': 0.09; 'python:': 0.09; 'received:80.91': 0.09; 'received:80.91.229': 0.09; 'received:gmane.org': 0.09; 'received:list': 0.09; 'subject:keys': 0.09; 'url:github': 0.09; 'language.': 0.14; 'idea:': 0.16; 'received:80.91.229.3': 0.16; 'received:plane.gmane.org': 0.16; 'section).': 0.16; 'subject:values': 0.16; 'travis': 0.16; 'language': 0.16; 'wrote:': 0.18; 'thoughts': 0.19; 'header:User-Agent:1': 0.23; 'subject:/': 0.26; 'header:X-Complaints-To:1': 0.27; 'header:In- Reply-To:1': 0.27; 'am,': 0.29; 'dec': 0.30; 'comments': 0.31; 'url:wiki': 0.31; 'url:wikipedia': 0.31; 'there,': 0.34; 'done': 0.36; 'url:org': 0.36; 'performance': 0.37; 'to:addr:python-list': 0.38; 'structure': 0.39; 'to:addr:python.org': 0.39; 'received:org': 0.40; 'here:': 0.62; 'our': 0.64; 'worth': 0.66; 'received:2': 0.84; '2013,': 0.91; 'rusi': 0.91; 'url:ru': 0.98 X-Injected-Via-Gmane: http://gmane.org/ To: python-list@python.org From: Mark Lawrence Subject: Re: grab dict keys/values without iterating ?! Date: Wed, 11 Dec 2013 18:09:34 +0000 References: <52A7AB8C.8030700@arcor.de> <52A7AB8C.8030700@arcor.de> <3efc283f-419d-41b6-ad20-c2901c3b9f78@googlegroups.com> <14D5EC89-0DFC-46D3-B9B9-EE6C468DB34E@gmail.com> Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Gmane-NNTP-Posting-Host: host-2-98-195-123.as13285.net User-Agent: Mozilla/5.0 (Windows NT 6.1; rv:24.0) Gecko/20100101 Thunderbird/24.2.0 In-Reply-To: <14D5EC89-0DFC-46D3-B9B9-EE6C468DB34E@gmail.com> X-BeenThere: python-list@python.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: General discussion list for the Python programming language List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Newsgroups: comp.lang.python Message-ID: Lines: 28 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1386785364 news.xs4all.nl 2859 [2001:888:2000:d::a6]:32987 X-Complaints-To: abuse@xs4all.nl Xref: csiph.com comp.lang.python:61602 On 11/12/2013 17:19, Travis Griggs wrote: > > On Dec 11, 2013, at 5:31 AM, rusi wrote: > >> >> The classic data structure for this is the trie: >> General idea: http://en.wikipedia.org/wiki/Trie >> In python: >> http://stackoverflow.com/questions/11015320/how-to-create-a-trie-in-python/ > > My thoughts exactly! > > If you wade through the comments there, someone has done a more-than-naive implementation here: > > https://github.com/kmike/marisa-trie > > The write up makes it look pretty favorable as well for performance (scroll 2/3s down to the Benchmarks section). > http://kmike.ru/python-data-structures/ from the author of the above is well worth a read. -- My fellow Pythonistas, ask not what our language can do for you, ask what you can do for our language. Mark Lawrence