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

Per object type hashing handlers #127

Open
shaypal5 opened this issue Nov 27, 2023 · 2 comments
Open

Per object type hashing handlers #127

shaypal5 opened this issue Nov 27, 2023 · 2 comments

Comments

@shaypal5
Copy link
Collaborator

A suggestion by @blakeNaccarato

"I think the hash function extension concept could be neatly extended by designating "handlers" for certain object types. Instead of overriding the entire hash method altogether, users could supply handlers which take an object and return a Hashable, which could be fed into a built-in pre-hasher stage that just applies all hash handlers. Sorry this is a different concept but I encountered it at the same time as the caching backend concept and wanted to address it. Would probably be a different Issue and feature effort altogether."

@shaypal5
Copy link
Collaborator Author

Off the top of my head:

  1. Checking types is less trivial in Python than in other programming languages, or at least slower, I think.
  2. What would the interface look like? It should be rather convenient and concise to provide 3 different handles, each is additionally provided with a type "spec" (letting cachier know with which object type this handler is associated). I'm imagining a dict; probably there's a sensible way to make this sufficiently convenient.

@blakeNaccarato
Copy link

It looks like time has gotten away from me here, so I figured I'd chime in to say I'm still alive. I haven't gotten around to the implementation, though I do still intend to, and would like to put time into it this month. If any passers-by see this and are eager to work on this themselves, just @ me and I'll try to respond promptly.

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

No branches or pull requests

2 participants