Tim Peters added the comment:

See also:

    https://en.wikipedia.org/wiki/Hamming_weight

As that says, there are a number of languages and processors with first class 
support for a popcount function.  I've frequently implemented it in Python when 
using integers as integer bitsets (`i` is in the set if and only if bit `2**i` 
is set in the integer), which often - except for finding the cardinality - runs 
much faster than using general Python sets.

----------
nosy: +tim.peters

_______________________________________
Python tracker <rep...@bugs.python.org>
<http://bugs.python.org/issue29882>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to