Skip to content

Instantly share code, notes, and snippets.

@dboyliao
Created December 5, 2024 08:23
Show Gist options
  • Save dboyliao/047b6673a643f2ced7efb8db0a2f072c to your computer and use it in GitHub Desktop.
Save dboyliao/047b6673a643f2ced7efb8db0a2f072c to your computer and use it in GitHub Desktop.
Dummy object mimic slow hashing
from time import sleep
class SlowHashObject:
def __init__(self, value):
self.value = value
def __hash__(self):
sleep(0.1)
return hash(self.value)
def __eq__(self, other):
if isinstance(other, SlowHashObject):
return self.value == other.value
return self.value == other
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment