snakeoil icon indicating copy to clipboard operation
snakeoil copied to clipboard

Require hashables for sequences.* unique functions

Open ferringb opened this issue 2 months ago • 0 comments

The current code has an explicit fallback that uses a list for unhashable items, which is a quadratic search for unhashable N. Not awesome, in short, but a byproduct of the compatibility shit snakeoil dealt with from py2k old/new style and then py3k adding the punch in the face.

My rough thought is to initially make this API typed as require Hashable, but don't change the algorithm. Depending on what mypy finds- how much of a pain in the ass this is to fix- if needed, add a hash_func=Callable[[Any], hashable] schwartzian transform callable.

ferringb avatar Dec 05 '25 18:12 ferringb