Is there an object like Set that doesn't save values?

I need a data type that will allow me to effectively track objects that have been “added” to it, which allows me to test membership. I do not need other functions.

As far as I can tell, Python doesn't have that kind of data. Closest to what I want is Set, but the set will always store values ​​(which I don't need).

For now, the best I can think of is to take hash()each object and store it in a set, but at a lower level, the hash hash is computed and the hash string is stored as a value.

Is there a way to use only low-level set search functions without actually pointing to anything?

+3
source share
2

, , , , , -.

- , , , . , .

, . , , , 2 3 , .

+3

weakref , , "" , , .

, WeakSet - , .

, , , Bloom filter, ( ), ( ).

: " , , , , , , "

0

All Articles