On Sun, Jul 19, 2020 at 1:34 PM Thomas Moreau email@example.com wrote:
While it would be nice to have simpler identifiers for objects, it would be hard to make it work for multiprocessing, as objects in different interpreter would end up having the same repr. Shared objects (locks) might also have different serial numbers depending on how many objects have been created before it is communicated to the child process.
Adding to what was said here, there are serious implications outside of the multiprocessing case, too...
1) In a multi-threaded Python, threads will need to contend over a per-type counter, serializing the allocation of those counted types.
2) In a Python with tagged immediates (like fixnums, etc.) the added space cost would disqualify counted types from being implemented as an immediate value. This would force counted types to be heap-allocated and suffer from the aforementioned serialization.