atom feed13 messages in org.python.python-dev[Python-Dev] object equality vs ident...
Subject:[Python-Dev] object equality vs identity, in and dicts idioms and speed
From:Tim Peters (tim.@home.com)
Date:Jan 3, 2002 6:59:46 pm
List:org.python.python-dev

[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>.