Benjamin Peterson added the comment:
"is" compares by identity not equality. Since tuples are immutable, the
interpreter is free to reuse or not reuse the same tuple instance when it
appears multiple times in a program. This is an implementation detail not a bug.
--
nosy: +benjamin.p
New submission from sattari :
The following code gives different results interactive and script mode:
e = (1, 2)
f = (1, 2)
print(e is f)
--
messages: 355867
nosy: sattari
priority: normal
severity: normal
status: open
title: is for tuples
type: behavior
versions: Python 3.7, Python 3.