Path: csiph.com!usenet.pasdenom.info!news.albasani.net!rt.uk.eu.org!newsfeed.xs4all.nl!newsfeed3.news.xs4all.nl!xs4all!newsgate.cistron.nl!newsgate.news.xs4all.nl!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.033 X-Spam-Evidence: '*H*': 0.93; '*S*': 0.00; 'favorable': 0.07; 'python:': 0.09; 'subject:keys': 0.09; 'url:github': 0.09; 'idea:': 0.16; 'section).': 0.16; 'subject:values': 0.16; 'wrote:': 0.18; 'thoughts': 0.19; 'subject:/': 0.26; 'header:In- Reply-To:1': 0.27; 'received:172.16': 0.29; 'am,': 0.29; 'dec': 0.30; 'comments': 0.31; 'url:wiki': 0.31; 'url:wikipedia': 0.31; 'there,': 0.34; 'received:google.com': 0.35; 'done': 0.36; 'charset:us-ascii': 0.36; 'url:org': 0.36; 'performance': 0.37; 'message-id:@gmail.com': 0.38; 'to:addr:python-list': 0.38; 'structure': 0.39; 'to:addr:python.org': 0.39; 'here:': 0.62; 'header:Message-Id:1': 0.63; '2013,': 0.91; 'rusi': 0.91 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=content-type:mime-version:subject:from:in-reply-to:date :content-transfer-encoding:message-id:references:to; bh=A0JjtrNnXscmYOqMC+JV+bs2PYb19s+pN5N6e3J5UuQ=; b=npCc0uXHafY1eLqf+xLj1engsnisE5czWzr8WkajoRaeaXyoiTcdG9AdN1zWk58f+Q GfZtp2JVLqmQLm3KU8aY+Ez+Mo5OlTDD4w4FHH+2JX7X29EHUgVm/8j9e3EgLLAuTiK7 tD9LhtgJirYrnYABpF7rzdqenOT6tgbc7warNQVyThiPieolV0xTky7+a56OYmmD+GuQ C9xFiHGQi0V6HpLagKEd5gqkUNyEj0ADx59SuL9jUseh9HBoDCJwsvFW3ytz86GQlwDG mz5A4z9uOZdG2isJG9cjs1SiZsyiDbkUbBJX3C5zBplWCskgvo1wKqkCREssONRZzNnH 5YiQ== X-Received: by 10.68.204.136 with SMTP id ky8mr3167322pbc.33.1386782394564; Wed, 11 Dec 2013 09:19:54 -0800 (PST) Content-Type: text/plain; charset=us-ascii Mime-Version: 1.0 (Mac OS X Mail 7.0 \(1822\)) Subject: Re: grab dict keys/values without iterating ?! From: Travis Griggs In-Reply-To: <3efc283f-419d-41b6-ad20-c2901c3b9f78@googlegroups.com> Date: Wed, 11 Dec 2013 09:19:48 -0800 Content-Transfer-Encoding: quoted-printable References: <52A7AB8C.8030700@arcor.de> <52A7AB8C.8030700@arcor.de> <3efc283f-419d-41b6-ad20-c2901c3b9f78@googlegroups.com> To: python-list@python.org X-Mailer: Apple Mail (2.1822) 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: 23 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1386782404 news.xs4all.nl 2956 [2001:888:2000:d::a6]:50730 X-Complaints-To: abuse@xs4all.nl Xref: csiph.com comp.lang.python:61601 On Dec 11, 2013, at 5:31 AM, rusi wrote: >=20 > 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).