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 mark.dickinson
Recipients fredrikj, loewis, mark.dickinson, pitrou, rhettinger, skip.montanaro, terry.reedy, vstinner
Date 2008-12-16.19:41:47
SpamBayes Score 0.00010895525
Marked as misclassified No
Message-id <>
Thanks for all the comments.  Here's an updated patch, with quite a few 

 - drop lookup tables in favour of "while(x) {x >>= 1; count += 1;}"
 - add example to docstring, and use PyDoc_STRVAR macro for docstrings

 - add "bin(37)" to whatsnew example
 - move main documentation out of the bit operations table into its own
   subsection, so that it can be indexed properly.
 - expand main documentation with examples, informal definition,
   equivalent Python code
 - I dropped the 1 + math.floor(...) definition from the docs, judging
   that 1 informal, 1 formal and 1 Python definition should be enough.

 - as proposed by Raymond, directly check equivalence with formal
   definition, equivalent Python code, and two other possible definitions.

(FWIW I prefer 'x>>1' over 'x//2' in the Python code, because it's more 
immediately related to the intended sense:  the operation should be 
thought of as a bit shift rather than a division.)
Date User Action Args
2008-12-16 19:41:53mark.dickinsonsetrecipients: + mark.dickinson, loewis, skip.montanaro, rhettinger, terry.reedy, pitrou, vstinner, fredrikj
2008-12-16 19:41:53mark.dickinsonsetmessageid: <>
2008-12-16 19:41:52mark.dickinsonlinkissue3439 messages
2008-12-16 19:41:51mark.dickinsoncreate