What is the best way to generate a set of bitarray-like objects so that I can test for membership efficiently. The naive way doesn't seem to work as I expect:
>>> from bitarray import bitarray
>>>
>>> bitarray_set = set([bitarray('0000'), bitarray('0001')])
>>> bitarray_set
set([bitarray('0001'), bitarray('0000')])
>>>
>>> bitarray('0000') in bitarray_set
False
A workaround is to keep a separate set of strings or other more friendly object as keys. Then convert a bitarray to a string and test membership against this set instead. But that seems a bit cumbersome. Is there a better solution?