Is there a Python container that acts like a dictionary but doesn't need both key and value?
Advertisements Say I have: @dataclass class Foo: foo_id: int # Other interesting fields. def __hash__(self): return self.foo_id.__hash__() And I make a foos_set = {Foo(i) for i in range(10)}. I had always assumed that set.remove used the hash for constant-time lookup. So I thought it would be reasonable to think that foos_set.remove(6) should work. But actually,… Read More Is there a Python container that acts like a dictionary but doesn't need both key and value?