On Thu, 26 Nov 2015 09:34 pm, Dave Farrance wrote:
> (Conversely, I see that unlike CPython, all PyPy's numbers have > unchanging ids, even after exiting PyPy and restarting, so it seems that > PyPy's numerical ids are "faked".) > > [PyPy 2.6.1 with GCC 4.9.2] on linux2 >>>>> id(1+2j) > 679900119843984469027190799480815353863L > > [PyPy 2.6.1 with GCC 4.9.2] on linux2 >>>>> id(1+2j) > 679900119843984469027190799480815353863L I'm pretty sure that they are faked. I remember seeing a question on the pypy-dev mailing list asking whether it was important that object IDs remained stable. They had a problem where the JIT compiler would take a Python list, convert it to a low-level array of machine-sized ints for fast processing, and then recreate the list. This all happened in the background without the user knowing, and the PyPy devs needed to know if it was important that the object ID of the new list matched the old list. The language guarantees that the id of an object won't change for the lifespan of the object, and consequently PyPy has to fake them. -- Steven -- https://mail.python.org/mailman/listinfo/python-list