Mark Dickinson <dicki...@gmail.com> added the comment: > Just for clarification, why does "ci" get padded but "ic" doesn't?
Because no padding is necessary in the second case: both the integer and the character already start at a position that's a multiple of 4---the integer at position 0 and the character at position 4. In the first case, without padding, the integer wouldn't start at a word boundary. The aim is to make sure that the byte sequence output by struct.pack matches the layout of a corresponding C struct. In the first case inter- item padding is necessary to make that work, in the second it isn't. You could argue that in the second case, Python should add trailing padding, but I'm not sure what the point would be. ---------- _______________________________________ Python tracker <rep...@bugs.python.org> <http://bugs.python.org/issue7355> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com