Consider using `functools` for argument hashing
NickCrews opened this issue · comments
Looking at how arg and kwarg hashing is done now, it is a little different from how the stdlib does it with functools.cache (see https://github.com/python/cpython/blob/3.10/Lib/functools.py#L448)
I think this builtin method is
- more efficient
- more bugfree (note the kwd_mark that separates the args from kwargs)
- better maintained
What about switching to just using functools._make_key
as the default hash function? Important to consider if the order of kwargs is important, they decided it was NOT, but I think swapping to this would be breaking for users here.
As a side note, monogo_core.get_entry() and memory_core.get_entry() have duplicated hashing logic that I think could get factored out?
I'd definitely consider any PR implemeting this very positively.
If it passes all the tests, and as long that it isn't slower (shouldn't be, right?) - it's in!
Solved by PR #104