On Sun, Jul 19, 2020 at 06:38:30PM +0300, Serhiy Storchaka wrote:
What if use serial numbers to differentiate instances?
I like this idea. It is similar to how Jython and IronPython object IDs work:
# Jython >>> id(None) 2 >>> id(len) 3 >>> object() <object object at 0x4>
I do not propose to use serial numbers for all objects, because it would increase the size of objects and the fixed-size integer can be overflowed for some short-living objects created in mass (like numbers, strings, tuples). But only for some custom objects implemented in Python, for which size and creation time are not critical. I want to start with synchronization objects in threading and multiprocessing which did not have custom reprs, than change reprs of locks and asyncio objects.
This sounds reasonable to me. +1