Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

is for tuples #82847

Closed
sattari mannequin opened this issue Nov 2, 2019 · 2 comments
Closed

is for tuples #82847

sattari mannequin opened this issue Nov 2, 2019 · 2 comments
Labels
3.7 (EOL) end of life 3.8 only security fixes type-bug An unexpected behavior, bug, or error

Comments

@sattari
Copy link
Mannequin

sattari mannequin commented Nov 2, 2019

BPO 38666
Nosy @benjaminp

Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.

Show more details

GitHub fields:

assignee = None
closed_at = <Date 2019-11-02.14:05:58.307>
created_at = <Date 2019-11-02.12:52:53.568>
labels = ['3.8', 'type-bug', '3.7', 'invalid']
title = 'is for tuples'
updated_at = <Date 2019-11-02.14:05:58.297>
user = 'https://bugs.python.org/sattari'

bugs.python.org fields:

activity = <Date 2019-11-02.14:05:58.297>
actor = 'benjamin.peterson'
assignee = 'none'
closed = True
closed_date = <Date 2019-11-02.14:05:58.307>
closer = 'benjamin.peterson'
components = []
creation = <Date 2019-11-02.12:52:53.568>
creator = 'sattari'
dependencies = []
files = []
hgrepos = []
issue_num = 38666
keywords = []
message_count = 2.0
messages = ['355867', '355869']
nosy_count = 2.0
nosy_names = ['benjamin.peterson', 'sattari']
pr_nums = []
priority = 'normal'
resolution = 'not a bug'
stage = 'resolved'
status = 'closed'
superseder = None
type = 'behavior'
url = 'https://bugs.python.org/issue38666'
versions = ['Python 3.7', 'Python 3.8']

@sattari
Copy link
Mannequin Author

sattari mannequin commented Nov 2, 2019

The following code gives different results interactive and script mode:

e = (1, 2)
f = (1, 2)
print(e is f)

@sattari sattari mannequin added 3.7 (EOL) end of life 3.8 only security fixes type-bug An unexpected behavior, bug, or error labels Nov 2, 2019
@benjaminp
Copy link
Contributor

"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.

@ezio-melotti ezio-melotti transferred this issue from another repository Apr 10, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
3.7 (EOL) end of life 3.8 only security fixes type-bug An unexpected behavior, bug, or error
Projects
None yet
Development

No branches or pull requests

1 participant