Path: csiph.com!usenet.pasdenom.info!goblin1!goblin.stu.neva.ru!uio.no!news.tele.dk!news.tele.dk!small.news.tele.dk!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.006 X-Spam-Evidence: '*H*': 0.99; '*S*': 0.00; 'received:80.91': 0.09; 'received:80.91.229': 0.09; 'received:gmane.org': 0.09; 'received:list': 0.09; 'strings.': 0.09; 'subject:question': 0.10; 'received:80.91.229.3': 0.16; 'received:plane.gmane.org': 0.16; 'tuple': 0.16; 'values?': 0.16; 'index': 0.16; 'wrote:': 0.18; 'bit': 0.19; 'normally': 0.19; 'header:User-Agent:1': 0.23; 'mon,': 0.24; 'script': 0.25; 'first,': 0.26; 'header:X -Complaints-To:1': 0.27; 'header:In-Reply-To:1': 0.27; 'ideal': 0.29; 'tuples': 0.31; 'text': 0.33; 'but': 0.35; 'add': 0.35; 'much.': 0.36; 'two': 0.37; 'nov': 0.38; 'to:addr:python-list': 0.38; 'to:addr:python.org': 0.39; 'either': 0.39; 'received:org': 0.40; 'how': 0.40; 'containing': 0.69; 'received:myvzw.com': 0.84; '2013': 0.98 X-Injected-Via-Gmane: http://gmane.org/ To: python-list@python.org From: Dave Angel Subject: Re: Data structure question Date: Sun, 17 Nov 2013 21:25:03 -0600 References: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit X-Gmane-NNTP-Posting-Host: 135.sub-70-208-163.myvzw.com In-Reply-To: User-Agent: Groundhog Newsreader for Android 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: 17 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1384745107 news.xs4all.nl 15936 [2001:888:2000:d::a6]:57877 X-Complaints-To: abuse@xs4all.nl Xref: csiph.com comp.lang.python:59829 On Mon, 18 Nov 2013 02:03:38 +0000, "Joseph L. Casale" wrote: > I have a need for a script to hold several tuples with three values, two text > strings and a lambda. I need to index the tuple based on either of the two > strings. Normally a database would be ideal but for a self-contained script > that's a bit much. How about two dictionaries, each containing the same tuples for values? If you create a tuple first, then add it to both dicts, you won't have any space-wasting duplicates. -- DaveA