On 11 July 2011 20:29, Bengt Richter <b...@oz.net> wrote: > On 07/10/2011 09:13 PM Laura Creighton wrote: >> >> What do we want to happen when somebody -- say in a C extension -- takes >> the id of an object >> that is scheduled to be removed when the gc next runs? > > IMO taking the id should increment the object ref counter > and prevent the garbage collection, until the id value itself is garbage > collected.
This significantly changes the meaning of id() in a way that will break existing code. If you want an object reference, just use one. If you want them to be persistent, build a dictionary from id to object. You can already do this yourself in pure python, and it doesn't have the side-effect of bloating id(). Otherwise, such a suggestion should go through the usual process for such a significant change to a language primitive. -- William Leslie _______________________________________________ pypy-dev mailing list pypy-dev@python.org http://mail.python.org/mailman/listinfo/pypy-dev