This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author rhettinger
Recipients fredrikj, loewis, mark.dickinson, rhettinger, terry.reedy, vstinner
Date 2008-12-12.22:47:52
SpamBayes Score 0.0067965644
Marked as misclassified No
Message-id <>
The code looks fine.

For speed, you could insert the following just before the while-loop:

    while (n >= 256) {
        n >>= 8;
        result += 8;

Am not sure the "numbits" is the right-name.  Is there precedent in
other languages or texts on bit-twiddling techniques?  For
numbits(0b0100), I could forsee people predicting a result of 4, 3, or 1
depending on their world-view of what numbits might mean.  Personally, I
tend to think in term of high-bit location or somesuch.
Date User Action Args
2008-12-12 22:47:54rhettingersetrecipients: + rhettinger, loewis, terry.reedy, mark.dickinson, vstinner, fredrikj
2008-12-12 22:47:54rhettingersetmessageid: <>
2008-12-12 22:47:53rhettingerlinkissue3439 messages
2008-12-12 22:47:52rhettingercreate