Marko Rauhamaa marko at
Wed Mar 5 21:34:31 CET 2014

Steven D'Aprano <steve+comp.lang.python at>:

> The id() function in Python is not defined as returning the address of
> the object.

It might as well. If I said id() returns the address of the object in
the Python VM's virtual address space, you couldn't call my bluff.

Say id() returned the intantiation sequence number. I could say, the
infinite linear memory starts from address 0 and each object occupies a
single memory slot.

> That's wrong. Jython is not an imitation, it is an independent
> implementation of the same language. Since both CPython and Jython
> follow the specification of the language, both are legitimate Python
> compilers.
> Both the Jython and CPython id() functions are compliant with the
> language definition. The Jython id() function is better, because it
> doesn't encourage people to mistakenly and foolishly imagine that id()
> equals address.

I agree with everything (how could I not) except the foolishness part:
what bad consequence is there for "imagining" that id() equals address?
If id() offers the only glimpse into the "memory," we can say that id()
*is* the address.


More information about the Python-list mailing list