Counting bits in large string / bit vector

Nizamov Shawkat nizamov.shawkat at
Mon Sep 26 09:56:56 CEST 2011

> Is there an equivalent command in python that would immediately provide the
> number of set bits in a large bit vector/string

You might be able to achieve this using numpy boolean array and, e.g,
the arithmetic sum function or something similar.
There is also another library
which resembles numpy's bit array.

Hope it helps,

More information about the Python-list mailing list