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

2020年7月25日 20:51:07 -0700

On Sun, Jul 19, 2020, at 13:02, Guido van Rossum wrote:
> That looks expensive, esp. for objects implemented in Python — an extra 
> dict entry plus a new unique int object. What is the problem you are 
> trying to solve for these objects specifically? Just that the hex 
> numbers look distracting doesn’t strike me as sufficient motivation. 
Could the numbers be kept outside the object, perhaps in a weak* dictionary 
that's maintained in the __repr__ method, so you don't pay for it if you don't 
use it? *if the object's hash/eq use identity, anyway... a "weak identity-keyed 
dictionary" might be a nice thing to add anyway
_______________________________________________
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/I34MYQDLIJNWEHV2JFO4QAKIZKCFTG7A/
Code of Conduct: http://python.org/psf/codeofconduct/

Reply via email to