This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

classification
Title: is for tuples
Type: behavior Stage: resolved
Components: Versions: Python 3.8, Python 3.7
process
Status: closed Resolution: not a bug
Dependencies: Superseder:
Assigned To: Nosy List: benjamin.peterson, sattari
Priority: normal Keywords:

Created on 2019-11-02 12:52 by sattari, last changed 2022-04-11 14:59 by admin. This issue is now closed.

Messages (2)
msg355867 - (view) Author: (sattari) Date: 2019-11-02 12:52
The following code gives different results interactive and script mode:

e = (1, 2)
f = (1, 2)
print(e is f)
msg355869 - (view) Author: Benjamin Peterson (benjamin.peterson) * (Python committer) Date: 2019-11-02 14:05
"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.
History
Date User Action Args
2022-04-11 14:59:22adminsetgithub: 82847
2019-11-02 14:05:58benjamin.petersonsetstatus: open -> closed

nosy: + benjamin.peterson
messages: + msg355869

resolution: not a bug
stage: resolved
2019-11-02 12:52:53sattaricreate