struct calcsize discrepency?

Mark Dickinson mdickinson at enthought.com
Mon Dec 5 03:20:32 EST 2011


On Dec 5, 8:09 am, Chris Angelico <ros... at gmail.com> wrote:
> May be, yes, but since calcsize() is returning 12 when the elements
> are put in the other order, it would seem to be not counting such
> padding.

Indeed.  That's arguably a bug in the struct module, and one that
people have had to find workarounds for in the past.  See note 3 at:

http://docs.python.org/library/struct.html#byte-order-size-and-alignment

If it weren't for backwards compatibility issues, I'd say that this
should be fixed.

--
Mark



More information about the Python-list mailing list