bitsize?

David C. Ullrich ullrich at math.okstate.edu
Fri Mar 17 19:43:01 CET 2000


Tim Peters wrote:

> [posted & mailed]
>
> [David C. Ullrich]
> > ...
> > It would be nice if there was a builtin "bitsize" function
> > returning the number of bits in a long value. (Ie ceil(log_2(n)),
> > more or less).
>
> Yes, it would.  I obtained provisional permission from Guido to trying
> adding this as a method on longs (the function is too specialized to justify
> polluting the builtins).  Never did the work, though.  On two previous
> occasions this came up, two other people volunteered to add this (along with
> some other methods on longs), but soon after vanished from the face of
> Python's version of Earth.  So the only rational conclusion is that this
> idea is cursed!

    That's what it sounds like to me all right.

> [...]
>
> > something inside Python knows how many bits the long
> > is taking, and I don't see what harm it could do to expose
> > this information. It's not like I want the address or anything...
>
> Heh heh -- getting the address is easy now.

    Seriously? You mean like in 1.6 we can get the address of
the data? (Oh - you hinted about this to the guy who wanted
pointers, right?)

> >     (Speaking of addresses: Does anyone know a valid one
> > for Jurjen N.E. Bos, the author of real.py? I have a few that
> > don't work if you want to trade.)
>
> Nope.  I had snail-mailed some papers on the constructive reals to him when
> he was writing real.py, and we corresponded about it over some number of
> months.  Then he vanished!  It's a conspiracy all right, but its nefarious
> goals remain clouded.
>
> BTW, Hans Boehm recently (within the last year) ported his version of
> infinite-precision reals to Java, and that's available somewhere on the SGI
> web site.  "One of these days" I hope to port that to Python.
>
> everyone-please-hold-their-breath-ly y'rs  - tim

    Inhaling... Face turning blue... bluer... gasp, couldn't do it. Sorry.

DU




More information about the Python-list mailing list