[issue11436] Clarify struct doc for format 's', when it is mentioned without numeric prefix

Terry J. Reedy report at bugs.python.org
Thu Jul 7 03:44:03 CEST 2011


Terry J. Reedy <tjreedy at udel.edu> added the comment:

Those others field types have a standard or system-dependent fixed size and a number is an optional repeat count. Format 's' is always a single field because number prefix for that is special -- a field size.

"For the 's' format character, the count is interpreted as the length of the bytes, not a repeat count like for the other format characters; for example, '10s' means a single 10-byte string, while '10c' means 10 characters. "

I happen to think is could use a few more words of special explanation. Looking again, I think ", which defaults to 1" after the first 'count' above, would be sufficient. We nearly always docucument defaults.

----------

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


More information about the Python-bugs-list mailing list