-
Notifications
You must be signed in to change notification settings - Fork 22
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
unpickle dictionary with tuple as keys #4
Comments
An edge case, but I can probably take a stab at it soon. |
I'm fairly new to Go, but would you accept a PR if I got it working? I assume that the tuple type doesn't have a hashing function, and this is causing the problem? |
Sure. Give it a go. Pun intended.
|
so it seems like slices are non comparable so they can't be used as keys in Go. So this might not be possible :( |
It's definitely doable, its just a matter of coming up with the right abstraction since this isn't supported by Golang very well in its native state. |
I thought about copying the slice to an array, then it becomes immutable (which fits quite nicely with tuples) and comparable, the problem is you cant create an array of variable length. Also I thought about just returning a string representation of the python tuple and that seems to work, but that's not exactly ideal. |
After thinking about this more, I came up with a couple points
|
Hi!
I'm trying to unpickle a dictionary with tuples as keys and I'm getting the following error:
code:
Probably a bit of an edge case though!
The text was updated successfully, but these errors were encountered: