2.3 -> 2.4: long int too large to convert to int
bokr at oz.net
Fri Sep 16 21:56:55 CEST 2005
On Fri, 16 Sep 2005 14:57:15 -0000, Grant Edwards <grante at visi.com> wrote:
>What I would really, really like are fixed length integer types
>so that I can manipulate 8, 16, 32 and maybe 64 bit, 2's
>compliment values. I've seen some pretty good "user-space"
>pure-python implimentations, but haven't gotten around to using
>them in production yet.
>One of the nasty bits in a pure-python approach is that there's
>no way to write a literal with a fixed length. For example,
>instead of writing 0xf7 to get an 8-bit value and 0x12345789 to
>get a 32-bit value, you have to instantiate a class like
>Word8(0xf7) and Word32(0x12345678).
>That starts to make things pretty hard to read.
I'm not sure at what point you actually need "fixed width" other
than passing to some non-python interface, in which case an
interface object could have a suitable property to do the final
trimming or padding of bits. Or do you want to define some kind
of mathematical space? For specifying bits in literals see my
other post in this thread (I think ;-)
More information about the Python-list