[Python-Dev] Pie-thon benchmark code ready
Guido van Rossum
guido at python.org
Thu Jan 1 20:45:07 EST 2004
> At 14:52 01.01.2004 -0500, Tim Peters wrote:
> >IOW, CPython is enduring some pain to try to make this consistent too; it's
> >not only Jython that can't get a free ride here.
[Samuele]
> is not about having a free ride, it's just that printing the id(.)
> in Jython as a 'at 0x<hex-something>' is misleading because id(.)
> now is different from System.identityHashCode which is what goes
> into the java cls@<identity-hash-code> repr.
I don't care either way. The importance of having *some* number here
is that for ordinary objects, if you print two different ones, the
repr() will show you that they are different, and if you print the
same one twice, repr() will show that too. I don't recall ever having
taken the id() of an object or the address from a repr() and looked it
up in memory using a debugger.
OTOH if there's a way to get the Java runtime to print things like
<obj>@<addr> it might make sense to get Python's runtime to print the
same number after 'at'; in general giving developers a warm fuzzy
feeling of comfort through familiarity is good if it doesn't interfere
with other goals.
So I'd be happy if we could standardize on 'at 0x...' at least for all
objects where CPython currently uses that, letting implementations
choose what to put after the 0x, as long as it's hex digits.
We can discuss what's the best repr() for new-style classes going
forward; since the module is included in the repr I'm less concerned
about having the address in there (multiple classes with the same name
are an anomaly, while multiple instances with the same class are
normal).
--Guido van Rossum (home page: http://www.python.org/~guido/)
More information about the Python-Dev
mailing list