STINNER Victor <[email protected]> added the comment:
> I think the ob_refcnt Field should be 1 in both cases. Or why is the refcnt
> here so high?
Python has singletons for short strings: empty string and 1-character latin1
characters (unicode range [U+0000; U+00FF]).
Examples:
>>> sys.getrefcount("")
103
>>> sys.getrefcount("a")
11
It's not a bug, but an optimization to reduce the memory footprint ;-)
----------
nosy: +vstinner
resolution: -> not a bug
stage: -> resolved
status: open -> closed
_______________________________________
Python tracker <[email protected]>
<https://bugs.python.org/issue39109>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe:
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com