At 15:37 06.08.2003 -0400, Tim Peters wrote: >[Samuele Pedroni] > > but that something like id() can be cheaply offered/exposed is very > > much a characteristic of the underlying GC implementation that is > > being exploited (objects don't move), > >The docs for id() just promise a unique integer; it needn't be a memory >address. care to suggest a cheap way to get such a unique integer that's not the address. > > and the GC impl is an overall implementation detail. > > > > I have just gone through implementing a correct id() for Jython. > > > > For the serious usage id() would be better substituted by an identity > > mapping implementation > >Sorry, I don't know what that means, and a unique integer seems to be what >most users of id() are looking for. copy, pickle can use an identity mapping i.e a dictionary using identity instead of equality to do their business, this is more convenient if you cannot get a id() out of an address because otherwise I see no other way than keeping a weak identity mapping from objects to integral type values, the aforementioned unique integers. Likely using a type for which a counter to get fresh unique integers cheaply will not overflow too quickly. Or instead of the mapping attach such integrals value to each object. The latter is not an option for Jython, because we cannot attach things to general Java objects we have to deal with. regards.
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4