New submission from Tshepang Lekhonkhobe tshepang@gmail.com:
This example [1] assumes you are using a specific platform to check it out. I am using amd64, and I get different results. To fix, I prefix the format string with '>':
before: pack('hhl', 1, 2, 3)
after: pack('>hhl', 1, 2, 3)
1: http://hg.python.org/cpython/file/d3ddbad31b3e/Doc/library/struct.rst#l299
---------- assignee: docs@python components: Documentation messages: 160291 nosy: docs@python, mark.dickinson, meador.inge, tshepang priority: normal severity: normal status: open title: the struct example should give consistent results across different hardware platforms type: enhancement versions: Python 2.7, Python 3.2, Python 3.3
_______________________________________ Python tracker report@bugs.python.org http://bugs.python.org/issue14765 _______________________________________
Meador Inge meadori@gmail.com added the comment:
And the examples make an explicit note of that:
""" .. note:: All examples assume a native byte order, size, and alignment with a big-endian machine. """
AMD64 is little-endian; the examples are noted to be in big-endian.
Is that note not sufficient?
----------
_______________________________________ Python tracker report@bugs.python.org http://bugs.python.org/issue14765 _______________________________________
Tshepang Lekhonkhobe tshepang@gmail.com added the comment:
Sadly, I noticed it only after submitting this report.
----------
_______________________________________ Python tracker report@bugs.python.org http://bugs.python.org/issue14765 _______________________________________
Changes by Meador Inge meadori@gmail.com:
---------- resolution: -> invalid stage: -> committed/rejected status: open -> closed
_______________________________________ Python tracker report@bugs.python.org http://bugs.python.org/issue14765 _______________________________________