-
-
Notifications
You must be signed in to change notification settings - Fork 18
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
Make Vector hashable #174
Comments
@astronouth7303 We discussed in a previous PR that the current API for It might be possible to work our way around that, if (and only if) |
Update: this is not the case, |
This is the point where I wish python had "semantically equal" or "equal enough" vs "exactly equal". For cases where users would want For dictionaries and uses involving Practically, you'd expect immutable values to be usable as dictionary keys. But for us, that's a can of worms. |
I mean, I'd find it very surprising for a tuple(0, 1) to hash to the same thing as Vector(0, 1) but that might just be experience with Python and not genuinely reasonable logic. |
Properly implementing Doing something like |
@pathunstrom The protocol for Also, it would be very surprising to have |
@astronouth7303 |
Closing, as this is impossible to do in a spec-compliant way. |
Allow
Vector
to be used as dictionary keys.While I don't expect to do much indexing by
Vector
, this is useful if you want to map Vector -> value for some reason (eg, in ppb-oneko, mapping directional vectors to their animation).The text was updated successfully, but these errors were encountered: