[Python-Dev] object equality vs identity, in and dicts idioms and speed

Tim Peters tim.one@home.com
Thu, 3 Jan 2002 22:00:08 -0500


[Samuele Pedroni]
> ...
> but mmh ... id is broken under jython (that means
> different objects can get the same id :( ) , also in 2.1 final.
>  It is a long-standing bug and yes we are about to solve it but
> there is a trade-off and jython id will become precise but many times
> slower wrt to CPython version (we need to implement a weak-key-table
> :( ).

Mapping what to what?  A fine implementation of id() would be to hand each
new object a unique Java int from a global counter, incremented once per
Python object creation -- or a Java long if any JVM stays up long enough
that 32 bits is an issue <wink>.