[Python-Dev] Re: Memory address vs serial number in reprs

2020年7月19日 09:42:02 -0700

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
-- 
Steven
_______________________________________________
Python-Dev mailing list -- [email protected]
To unsubscribe send an email to [email protected]
https://mail.python.org/mailman3/lists/python-dev.python.org/
Message archived at 
https://mail.python.org/archives/list/[email protected]/message/PDN2DF3BTU4P3N5MD5GEHUZRAT6ETGU5/
Code of Conduct: http://python.org/psf/codeofconduct/

Reply via email to