[issue11436] Clarify struct doc for format 's'.

Terry J. Reedy report at bugs.python.org
Mon Mar 7 19:29:38 CET 2011


New submission from Terry J. Reedy <tjreedy at udel.edu>:

The struct doc does not specify the meaning of 's', without a count. The attached patch adds the sentence:

 If a count is not given, it defaults to 1; ``'s'`` means the same as ``'1s'``.

(Until I experimented, I had thought no count meant indefinite length).

>>> struct.pack('sss', b'', b'a', b'ab')
b'\x00aa'
>>> struct.pack('1s1s1s', b'', b'a', b'ab')
b'\x00aa'

----------
messages: 130275
nosy: terry.reedy
priority: normal
severity: normal
status: open
title: Clarify struct doc for format 's'.
versions: Python 2.7, Python 3.1, Python 3.2, Python 3.3

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


More information about the Python-bugs-list mailing list