The platform-specific type codes interpretations for array.array make it more complex to write python code that contains known type codes and data bytes and will run reliably on all platforms. In particular, the 'l' and 'L' codes are 4 bytes on Windows, but 8 bytes on macOS. The 'i' and 'I' codes seem to be 4 in both cases, but that is a convention, not a requirement. There should be 4-byte and 8-byte integer types that guarantee that size regardless of platform---perhaps '4' and '8' for signed, '5' and '9' for unsigned. (I haven't tested other type codes.) The documentation should be updated in the meantime.
The text was updated successfully, but these errors were encountered:
Consistency between array and struct would be very desirable... I actually am using both, had meant to mention that. (I don't think there's any mention of specified endianness forcing a standard size FWIW)
dajoke commentedAug 31, 2022
The platform-specific type codes interpretations for array.array make it more complex to write python code that contains known type codes and data bytes and will run reliably on all platforms. In particular, the 'l' and 'L' codes are 4 bytes on Windows, but 8 bytes on macOS. The 'i' and 'I' codes seem to be 4 in both cases, but that is a convention, not a requirement. There should be 4-byte and 8-byte integer types that guarantee that size regardless of platform---perhaps '4' and '8' for signed, '5' and '9' for unsigned. (I haven't tested other type codes.) The documentation should be updated in the meantime.
The text was updated successfully, but these errors were encountered: