We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
Python removes negative ranges from dictionaries
Example to reproduce:
print({range(16, 1): 0.5, range(32, 16): 0.5})
The expected output:
{range(16, 1): 0.5, range(32, 16): 0.5}
The actual output:
{range(16, 1): 0.5}
The text was updated successfully, but these errors were encountered:
However, this seems interesting:
>>> a = {range(16, 1): 1} >>> a[range(32, 16)] = 2 >>> a {range(16, 1): 2}
Sorry, something went wrong.
You misunderstood something. Python doesn't remove anything from dictionary.
hash(range(32, 16)) == hash(range(16, 1)) > True # And there's need a check for objects equality range(32, 16) == range(16, 1) > True
So, after these checks, Python decides to change the value of key.
Since both are empty ranges... Thanks for the clarification
No branches or pull requests
Bug report
Python removes negative ranges from dictionaries
Example to reproduce:
The expected output:
The actual output:
Your environment
The text was updated successfully, but these errors were encountered: