Bit length of int or long?

Tim Peters tim_one at email.msn.com
Fri May 19 04:10:18 EDT 2000


[Darrell Gallion]
> Assuming it never hurts to ask.

It doesn't hurt me, but others may scream <wink>.

> >>> x=0xffffffff
> >>> x >> 1
> -1
>
> Wouldn't 0x7fffffff be nice,

Python exposes no unsigned integer type now.  For the integers (whether int
or long) it does support, it's guaranteed that i >> j == i / 2**j now, and
many integer programs rely on that identity.  So, no, it wouldn't be nice to
break that, notwithstanding that it may yet be nice to implement a
*different* zero-fill shift primitive (e.g., Java does that).

> maybe even a rotate function.

Maybe.

> My last hot idea to allow re to match nested patterns, produced
> only polite interest. So I'm sure my interests must be on the
> fringe :)

Many decades ago, I had the hot idea that printers should produce output in
color.  That only produced polite interest at the time too <wink>.

not-to-mention-my-hot-ideas-for-matter-transport-beams-ly y'rs  - tim






More information about the Python-list mailing list