News for hackers. Stuff that matters.
Re:Python: Making ctypes Structures Beautiful by wisesage5001 on Thursday July 12, 2012 @12:55PM (#4235437)
One thing I really like about the struct module's format string is the ability to easily specify the endian-ness of the data. How does newstruct (or the underlying ctypes) handle endian-ness (if at all)?
Re:Python: Making ctypes Structures Beautiful by veyron on Thursday July 12, 2012 @02:52PM (#4236045)
endianness only matters when you bother interpreting the data. The storage concept shouldn't care -- after all, 8 bytes is 8 bytes is 8 bytes.

Struct needs it because it is interpreting data. unpack needs to know the endianness to correctly interpret numeric types, and pack needs to know the endianness to know how to serialize.

FYI: the C way of doing this is byteswapping.