Some objects, numpy const arrays for example, are perfectly hashable but happened not to be (due to __eq__
being repurposed as an arithmetic operator, in the numpy case). Some objects, numpy arrays again for example, have multiple defintions of equility (id-equility and value-equility). For those object, a dict
with user provided key function (as in sorted
) would be very useful.
My question is: Is there a dict
with user provided key function, either builtin or implemented in few lines, in Python?