Mark Dickinson <dicki...@gmail.com> added the comment: I'm half-convinced that struct.pack *should* ideally add trailing padding in the same situation that C does, for consistency with C. Then calcsize would match C's sizeof. If you're writing or reading a struct from C, it's probably easiest/most natural to write or read sizeof(my_struct) bytes, rather than worrying about stripping trailing padding for efficiency.
I don't see a sensible way to make this change without breaking backwards compatibility, though. (Note: this still wouldn't mean that the calcsize result would be independent of order: calcsize('cci') and calcsize('cic') would still be different, for example, on a typical platform.) Eric's solution of adding '0i' should be included in the documentation update. ---------- _______________________________________ 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