MRAB wrote:
On Oct 8, 9:56 am, Mark Dickinson <[EMAIL PROTECTED]> wrote:
On Oct 7, 5:19 pm, [EMAIL PROTECTED] wrote:

but I want to make clear that I think that (0).numbits()==-1
is the natural solution. At least for all square-and-multiply-like
algorithms needed in [...]
Can you clarify this?  Why is -1 the natural solution? I
can see a case for 0, for -infinity (whatever that means),
or for raising an exception, but I can't see why -1 would
be at all useful or natural.

[snip]
Compare it with, say, str.find, which returns the position if found
(>=0) or -1 if not found.

str.find is an historical anomaly that should not be copied. It was(is?) a wrapper for C's string find function. C routinely uses -1 to mean None for functions statically typed to return ints. The Python version logically should return None and usually does for other functions.

--
http://mail.python.org/mailman/listinfo/python-list

Reply via email to