Skip to content
Discussion options

You must be logged in to vote

@sylvainbonnot explained it had to do with this optional prefix character ('@', '=', '<', '>', '!') which controls the byte order, size and alignment.
If the first character is not one of these, '@' is assumed.
Using '=' removes the "unexpected behavior":

>>> struct.calcsize('=hd') == struct.calcsize('=dh') == 10
True

Replies: 1 comment

Comment options

You must be logged in to vote
0 replies
Answer selected by thorwhalen
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants