Mark Dickinson <[EMAIL PROTECTED]> added the comment: > In every case I can think of, I've wanted (0).numbits() to be 0.
Me too, in most cases, though I've encountered the occasional case where raising ValueError would be more appropriate and would catch some bugs that might otherwise pass silently. So I agree that (0).numbits() should be 0, but I think there's enough potential ambiguity that there should be a sentence in the documentation making this explicit. Two of the most obvious (wrong) formulas for numbits are: (1) numbits(n) = ceiling(log_2(n)), and (2) numbits(n) = len(bin(n))-2, but neither of these formulas gives the right result for 0, or for negative numbers for that matter. > The explanation in the docstring can probably be improved. What other documentation is needed (where)? The docstring looked okay to me. There should be more comprehensive ReST documentation in the Doc/ directory somewhere, probably in Doc/library/stdtypes.rst _______________________________________ Python tracker <[EMAIL PROTECTED]> <http://bugs.python.org/issue3439> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com