-
-
Notifications
You must be signed in to change notification settings - Fork 403
Forbid float as key/index #861
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
Comments
Well, I would say that this is not actually a type error. That's a best practice: don't use |
In the case of sequences, it's TypeError. In the case of maps, it's dangerous. In both cases, it's bad after all. |
I guess we should forbid setting and getting some_map = {0.1: 'a'} # violation! |
I can try out this |
You are welcome! @abyss143 |
The only difference in the implementation is that we don't eval |
Rule request
Thesis
For lists/tuples float as key produces TypeError:
For dicts float is a bad idea because of accuracy:
So, let's catch simple cases:
Reasoning
The motivation is the same as in #739. Let's detect as many runtime errors statically as possible.
The text was updated successfully, but these errors were encountered: