Closed couzhei closed 2 weeks ago
The numbers in the range [-5, 256) are cached in CPython.
In the first case, you created a new tuple, so the addresses in memory for the resulting tuples will be different.
Please use ==
for comparisons, as suggested in the SyntaxWarning
.
Here's the doc about how the is
operator is works:
https://docs.python.org/3/reference/expressions.html#is
Please note that this repository is intended for CPython bug tracking, and if you have python-related questions, please ask them on https://discuss.python.org/c/users/7.
Bug report
Bug description:
Why should not two hashable object with the same value be equal when they are passed through a function?
CPython versions tested on:
3.10, 3.11, 3.12, 3.13, CPython main branch
Operating systems tested on:
Linux