[docs] Bug in "7.3. struct -- Interpret strings as packed binary data"

Oleksandr Kravchuk sashko.kravchuk at gmail.com
Fri Jul 30 17:33:29 CEST 2010


I've probably found a bug in first code example of " Examples"
section of http://docs.python.org/library/struct.html:
'pack('hhl', 1, 2, 3)' code returns '\x01\x00\x02\x00\x03\x00\x00\x00'
instead of '\x00\x01\x00\x02\x00\x00\x00\x03', that we have in document.

Also, first parameter of pack() function -- 'hhl' is probably incorrect,
because regarding to the table in the section " Format Characters",
we have to use 'hhh' value as we have 3 short digits.

Thank you! I hope I've described the problem clearly enough.

Oleksandr Kravchuk
http://www.sashko.rv.ua | @memoryleaks
+380 (63) 499-70-72 | Skype: sashko.kravchuk
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/docs/attachments/20100730/b5cdc61a/attachment.html>

More information about the docs mailing list