How to use a 5 or 6 bit integer in Python?

Paul Rubin http
Fri Dec 19 04:01:24 CET 2003

Glen Wheeler <adsl5lcq at> writes:
>   My program uses many millions of integers, and Python is allocating
> way too much memory for these.  I can't have the performance hit by
> using disk, so I figured I'd write a C extension to define a new type.
>   Problem is, my C knowledge is years old and regardless of my
> attempts distutils will not recognise my installation of the MS
> compiler.
>   I am thinking, is there any easier way to use a 5 or 6 bit integer
> in python?  Even a regular 8-bit would be fine.  I only need to
> represent either 32 or 64 distinct numbers.

Look at the docs for the array module.

More information about the Python-list mailing list