[issue8069] struct documentation problem and suggestion to add fixed size formats

Mark Dickinson report at bugs.python.org
Fri Mar 5 13:53:13 CET 2010


Mark Dickinson <dickinsm at gmail.com> added the comment:

Please note that the docs distinguish 'standard size and alignment' from 'native size and alignment'.  The standard size (which is what you get if your struct format string doesn't start with '<', '>', '=' or '!') does exactly what you suggest:  it gives struct codes a fixed size that's independent of platform.

>>> import struct
>>> struct.calcsize('L')   # native size and alignment
8
>>> struct.calcsize('<L')  # standard size and alignment
4

----------
nosy: +mark.dickinson

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue8069>
_______________________________________


More information about the Python-bugs-list mailing list