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


Groups > comp.lang.python > #19257

Re: access address from object and vice versa

From Duncan Booth <duncan.booth@invalid.invalid>
Newsgroups comp.lang.python
Subject Re: access address from object and vice versa
Date 2012-01-23 09:36 +0000
Message-ID <Xns9FE361B4B2EC3duncanbooth@127.0.0.1> (permalink)
References <4F1B7CA8.80702@googlemail.com> <mailman.4917.1327203395.27778.python-list@python.org> <4f1ba400$0$29987$c3e8da3$5496439d@news.astraweb.com>

Show all headers | View raw


Steven D'Aprano <steve+comp.lang.python@pearwood.info> wrote:

> On the other hand, presumably this means that Jython objects need an 
> extra field to store the ID, so the CPython approach is a space 
> optimization.
> 
Given that using `id()` is such an uncommon occurence I would expect the 
ids to be stored outside the object in something like a WeakKeyDictionary.
You can't do that in CPython as some objects aren't weakly referenceable, 
but if you removed that restriction it reduces the overhead.

IronPython & Jython both have garbage collectors that move objects around 
which is why even if you could get at the address it wouldn't be much use 
as it may change at any time.

-- 
Duncan Booth http://kupuguy.blogspot.com

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


Thread

Re: access address from object and vice versa Chris Rebert <clp2@rebertia.com> - 2012-01-21 19:36 -0800
  Re: access address from object and vice versa Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2012-01-22 05:52 +0000
    Re: access address from object and vice versa Duncan Booth <duncan.booth@invalid.invalid> - 2012-01-23 09:36 +0000
    Re: access address from object and vice versa Grant Edwards <invalid@invalid.invalid> - 2012-01-23 15:54 +0000

csiph-web