Steven D'Aprano <steve+comp.lang.pyt...@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 -- http://mail.python.org/mailman/listinfo/python-list