I’m having trouble understanding the result of the following statements:
>>> from array import array
>>> array('L',[0xff,0xff,0xff,0xff])
array('L', [255L, 255L, 255L, 255L])
>>> from array import array
>>> array('L','\xff\xff\xff\xff')
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
ValueError: string length not a multiple of item size
You are running this on a 64-bit build of Python, on which
arraytreats type code'L'as a 64-bit unsigned integer.The documentation isn’t very clear. All it says is that
'L'is at least four bytes.