SpreadTooThin wrote: > 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....
As it should. > So can't I truncate the long by discaring the upper bits .. > Like b[0] = 0x0000FFFF & a[0] Any reason why you don't you just try it? | >>> import array | >>> a = array.array('L', [65537]) | >>> b = array.array('H', [0]) | >>> a[0] | 65537L | >>> a[0] & 0xffff | 1L | >>> b[0] = a[0] & 0xffff | >>> b[0] | 1 | >>> -- http://mail.python.org/mailman/listinfo/python-list