[issue34100] Same integers in a tuple of constant literals are not merged

Serhiy Storchaka report at bugs.python.org
Thu Jul 12 00:52:16 EDT 2018


Serhiy Storchaka <storchaka+cpython at gmail.com> added the comment:

This is not only with integers.

>>> a = ((1, 2), (1, 2))
>>> a[0] is a[1]
False
>>> a = ('@#$', '@#$')
>>> a[0] is a[1]
False
>>> a = (1.0, 1.0)
>>> a[0] is a[1]
False

The only exception is short ASCII identifier-like strings (as a side effect of interning them):

>>> a = ('foo', 'foo')
>>> a[0] is a[1]
True

I'm not sure this is a problem which should be resolved.

----------

_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue34100>
_______________________________________


More information about the Python-bugs-list mailing list