[Python-ideas] IntFlags
Andrew Barnert
abarnert at yahoo.com
Fri Mar 6 03:25:15 CET 2015
On Mar 5, 2015, at 17:36, Greg Ewing <greg.ewing at canterbury.ac.nz> wrote:
> On 03/06/2015 01:41 PM, Serhiy Storchaka wrote:
>>
>> bitset in C++ and BitSet in Java are fixed-size arrays of booleans. They
>> support such operations as changing a range of bits, but are not compatible
>> with ints and sets.
>
> Java has an EnumSet, which is closer to what we're talking about. It
> supports set operations and uses a bit vector internally.
If you're looking for similar names in use, PyPI has (at least) modules named bitsets, bitset, bitmap, bitstring, bitarray, and flags, which are all related to what's being discussed here, but crucially without the enum-like naming of the bits.
(I've used bitstring and bitarray for things like examining the bits of a TCP header; the others I just saw when searching for bitarray when I couldn't remember its name...)
More information about the Python-ideas
mailing list