[issue3439] create a numbits() method for int and long types

Raymond Hettinger report at bugs.python.org
Tue Dec 16 21:16:59 CET 2008


Raymond Hettinger <rhettinger at users.sourceforge.net> added the comment:

IMO, the choices are something like my version or none at all.  The
repeated floor division by two of abs(x) has ZERO explanatory power and
may even detract from a beginner's ability to understand what the method
does.  Show that code to most finance people and they will avoid the
method entirely.

Anyone who disagrees needs to show both code fragments to some junior
programmers and see which best leads to understanding the method and
being able to correctly predict the edge cases bordering powers of two,
the zero case, and how negatives are handled.  

No fair trying this experiment on assembly language programmers ;-)

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue3439>
_______________________________________


More information about the Python-bugs-list mailing list