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


Groups > comp.lang.python > #5411

Re: dict: retrieve the original key by key

Path csiph.com!x330-a1.tempe.blueboxinc.net!aioe.org!feeder.news-service.com!news2.euro.net!newsgate.cistron.nl!newsgate.news.xs4all.nl!post.news.xs4all.nl!not-for-mail
Return-Path <chris@rebertia.com>
X-Original-To python-list@python.org
Delivered-To python-list@mail.python.org
X-Spam-Status OK 0.005
X-Spam-Evidence '*H*': 0.99; '*S*': 0.00; 'memory.': 0.05; 'dictionary': 0.07; 'python': 0.07; 'referenced': 0.09; 'sun,': 0.09; 'am,': 0.14; 'wrote:': 0.14; 'subject:key': 0.16; 'this?': 0.18; 'cc:no real name:2**0': 0.20; 'cc:2**0': 0.20; 'cheers,': 0.20; 'header:In-Reply-To:1': 0.22; 'cc:addr:python-list': 0.22; 'values': 0.23; 'keys': 0.23; 'objects,': 0.23; 'objects': 0.24; 'thus': 0.24; 'memory': 0.24; 'possible,': 0.25; 'define': 0.26; 'instead': 0.26; 'times.': 0.26; 'chris': 0.27; 'message- id:@mail.gmail.com': 0.28; 'lists': 0.28; 'received:209.85.161': 0.29; 'technical': 0.29; 'seem': 0.30; 'cc:addr:python.org': 0.31; 'does': 0.31; 'equal': 0.31; 'several': 0.33; 'there': 0.35; 'rather': 0.36; 'considered': 0.36; 'received:209.85': 0.37; 'useful': 0.37; 'received:google.com': 0.38; 'where': 0.39; 'received:209': 0.39; 'would': 0.40; 'header:Received:5': 0.40; 'retrieve': 0.60; 'huge': 0.62; '2011': 0.62; 'dear': 0.64; 'subject:original': 0.84
DKIM-Signature v=1; a=rsa-sha256; c=relaxed/relaxed; d=rebertia.com; s=google; h=domainkey-signature:mime-version:sender:in-reply-to:references:date :x-google-sender-auth:message-id:subject:from:to:cc:content-type :content-transfer-encoding; bh=2CHkgaE4xFkgHIDG2Mfgp4GMX8KVWx4CotmM0qIWNNI=; b=QPWRceGPibxi6/Au0K0pv1NvowMsbgqH9kGfj7YssdZbm5XRHdKaYnQFRs03MVOTWN C0L/6cgtyAfMzZv/Hswudz11DEWhFOEG7zuoKRAwmJp0B77EJhjGL1lEorJU6sTHZkud txFggCe9Al1Zd8nVFOrLeYjGA633HM5IzwnLg=
DomainKey-Signature a=rsa-sha1; c=nofws; d=rebertia.com; s=google; h=mime-version:sender:in-reply-to:references:date :x-google-sender-auth:message-id:subject:from:to:cc:content-type :content-transfer-encoding; b=CERIUnijk6aosSOdYkimwDa5x/jr8MaG96m3bz6msFpPOR+SrcUmdede91IlEDJzyK DNw3f1CQoGhsAcRVCzbLZa2fuXrOVVYEgsr3o9AQNwoUfEyYNOHx2zEGmNSi7ohfgQyS fTzM1gZbHu+FynnrDO95zOn0+s3PFGApNcbGA=
MIME-Version 1.0
Sender chris@rebertia.com
In-Reply-To <874o4wwenu.fsf@falma.de>
References <874o4wwenu.fsf@falma.de>
Date Sun, 15 May 2011 01:44:19 -0700
X-Google-Sender-Auth C-ysNT67650uq8dQi-Xl-E8-Ftw
Subject Re: dict: retrieve the original key by key
From Chris Rebert <clp2@rebertia.com>
To Christoph Groth <cwg@falma.de>
Content-Type text/plain; charset=UTF-8
Content-Transfer-Encoding quoted-printable
Cc python-list@python.org
X-BeenThere python-list@python.org
X-Mailman-Version 2.1.12
Precedence list
List-Id General discussion list for the Python programming language <python-list.python.org>
List-Unsubscribe <http://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 <http://mail.python.org/mailman/listinfo/python-list>, <mailto:python-list-request@python.org?subject=subscribe>
Newsgroups comp.lang.python
Message-ID <mailman.1581.1305449069.9059.python-list@python.org> (permalink)
Lines 21
NNTP-Posting-Host 82.94.164.166
X-Trace 1305449069 news.xs4all.nl 41102 [::ffff:82.94.164.166]:46532
X-Complaints-To abuse@xs4all.nl
Xref x330-a1.tempe.blueboxinc.net comp.lang.python:5411

Show key headers only | View raw


On Sun, May 15, 2011 at 1:28 AM, Christoph Groth <cwg@falma.de> wrote:
> Dear python experts,
>
> I use a huge python dictionary where the values are lists of that
> dictionary's keys (yes, a graph).  Each key is thus referenced several
> times.
>
> As the keys are rather large objects, I would like to save memory by
> re-using key objects wherever possible, instead of having several equal
> objects in memory.
>
> There does not seem to be a way to retrieve the original key from a
> python dictionary.  Is there a technical reason for this?  (Other than
> that such functionality was not considered to be useful enough.)

Define "original key".

Cheers,
Chris

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


Thread

Re: dict: retrieve the original key by key Chris Rebert <clp2@rebertia.com> - 2011-05-15 01:44 -0700

csiph-web