scott-griffiths / bitstring

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

Allow count to count more than just bits. #305

Closed scott-griffiths closed 3 weeks ago

scott-griffiths commented 11 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.

scott-griffiths commented 3 weeks ago

I'm not sure this is really a useful addition, so closing.