views:

71

answers:

3

Is there a Python class or module that implements a structure that is similar to the BitSet?

+5  A: 

There's nothing in the standard library. Try:

http://pypi.python.org/pypi/bitarray

Glenn Maynard
+3  A: 

Have a look at this implementation in python.

Emil
+4  A: 

You might like to take a look at a module I wrote called bitstring (full documentation here), although for simple cases that need to be as fast as possible I'd still recommend bitarray.

Some similar questions:

http://stackoverflow.com/questions/39663/what-is-the-best-way-to-do-bit-field-manipulation-in-python/

http://stackoverflow.com/questions/142812/does-python-have-a-bitfield-type

http://stackoverflow.com/questions/2450208/python-bitstream-implementations

Scott Griffiths