Need help with an array problem.

SpreadTooThin bjobrien62 at gmail.com
Mon Oct 2 17:55:53 EDT 2006


Basically I think the problem is in converting from a 32 bit integer to
a 16 bit integer.

I have two arrays:
import array

a = array.array('L', [65537])
b = array.array('H', [0])

b[0] = a[0]

Which gives an overflow message....
So can't I truncate the long by discaring the upper bits ..
Like  b[0] = 0x0000FFFF & a[0]

How does one normally cast an object from long to short?




More information about the Python-list mailing list