scott-griffiths / bitstring

A Python module to help you manage your bits
https://bitstring.readthedocs.io/en/stable/index.html
MIT License
401 stars 67 forks source link

Allow count to count more than just bits. #305

Open scott-griffiths opened 7 months ago

scott-griffiths commented 7 months ago

So instead of just counting how many zeros or ones, allow bs.count(x) which is roughly equivalent to len(bs.findall(x)).

There is now a count in bitarray that can be efficiently used. It probably makes sense to allow a bytealigned parameter too.