Frédéric van der Plancke fplancke at
Wed Mar 22 19:10:05 CET 2000

In article <000201bf8fd9$649f4d20$682d153f at tim>,
"Tim Peters" <tim_one at> 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
> polluting the builtins). Never did the work, though.

Is that that much work ?
I'm asking this because I'm also interested in bitsize and other bit
methods on longs (like direct access to the i-th bit of a number,
perhaps also bit fields), so perhaps I try to implement them...

I most probably know enough of C to do that (I know C++ well and
have some pure-C experience) but I haven't written any Python
extension yet...

> So the only rational conclusion is that this
> idea is cursed!
So I prefer to promise nothing ;-)
I don't have that much time anyway :-(

(Sorry if this message has a strange layout. Deja-news's
responsibility, I think.)

Frederic van der Plancke
e-mail address: reverse and add dots etc. to:
<com writeme vdplancke frederic>

Sent via
Before you buy.

More information about the Python-list mailing list