Skip to content
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

PathValue should be usable in dict and set #12

Open
ovangle opened this issue Apr 23, 2021 · 0 comments
Open

PathValue should be usable in dict and set #12

ovangle opened this issue Apr 23, 2021 · 0 comments

Comments

@ovangle
Copy link
Contributor

ovangle commented Apr 23, 2021

When dealing with trees, it's quite common to use a dictionary to label nodes, using the path as the key. Currently this can be accomplished by casting the path to str, but this introduces a lot of unnecessary casts.

Ideally, PathValue should extend tuple instead of list, but since this would be a breaking change, perhaps it's better to implement __hash__ on PathValue?

I'd imagine most code would treat paths as immutable anyway.

Thoughts?

I'd be happy to submit a PR implementing whatever you decide is the best course of action.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant