Long integer arrays in Python; how? /Carl
Robert Kern
robert.kern at gmail.com
Mon Nov 28 17:14:21 EST 2005
Carl wrote:
> I have the following problem
>
> import Numeric
> dim = 1
> bits = 32
> v = Numeric.zeros((dim, bits), 'l')
> for j in range(bits):
> v[0][j] = 1L << bits - j - 1
>
> The problem is the last assignment, which is not valid, since the integer is
> on the right hand side is to large to be assigned to an array element.
Use Numeric.UnsignedInt32 as the data type.
--
Robert Kern
robert.kern at gmail.com
"In the fields of hell where the grass grows high
Are the graves of dreams allowed to die."
-- Richard Harter
More information about the Python-list
mailing list