New submission from Dan Rose <daniel.buch...@gmail.com>:

In the Python 3.7.0 interpreter, the following evaluates to False. In 3.6.4, it 
was True:

    c,d = 500,500
    c is d

This seems to be because, in some cases, Python 3.7 fails to intern integers 
inside tuples:

    a = (500,500)
    print(a[0] is a[1]) # False
    
    a = (500,500,42)
    print(a[0] is a[1]) # False
    
    a = (500,500,'42')
    print(a[0] is a[1]) # False
    
    answer = 42
    a = (500,500,answer)
    print(a[0] is a[1]) # True
    
    a = (500,500,[42])
    print(a[0] is a[1]) # True

    a = [500,500]
    print(a[0] is a[1]) # True

I believe the above should all return True.

----------
messages: 321495
nosy: Dan Rose
priority: normal
severity: normal
status: open
title: Python doesn't intern integers in a tuple of constant literals
type: behavior
versions: Python 3.7

_______________________________________
Python tracker <rep...@bugs.python.org>
<https://bugs.python.org/issue34100>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to