how to get the thighest bit position in big integers?

Aaron "Castironpi" Brady castironpi at gmail.com
Thu Oct 9 00:24:17 EDT 2008


On Oct 8, 7:21 pm, greg <g... at cosc.canterbury.ac.nz> wrote:
> Terry Reedy wrote:
> > 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.
>
...
> [I]t can
> be inconvenient having a function that returns different
> types under different circumstances.
...

No.  It has precedent and there is no cost to convenience in pure
Python.

Perhaps you are passing the result straight to a C extension, and
parsing it straight to integer, but I can't attest to how common that
use case is.



More information about the Python-list mailing list