[Python-checkins] cpython (3.2): Fix closes Issue11436 - Minor clarification to struct documentation for 's'

senthil.kumaran python-checkins at python.org
Sun Jul 17 11:32:23 CEST 2011


http://hg.python.org/cpython/rev/90cdf403132e
changeset:   71382:90cdf403132e
branch:      3.2
parent:      71378:362556f980ac
user:        Senthil Kumaran <senthil at uthcode.com>
date:        Sun Jul 17 17:29:17 2011 +0800
summary:
  Fix closes Issue11436 - Minor clarification to struct documentation for 's' format character.

files:
  Doc/library/struct.rst |  9 +++++----
  1 files changed, 5 insertions(+), 4 deletions(-)


diff --git a/Doc/library/struct.rst b/Doc/library/struct.rst
--- a/Doc/library/struct.rst
+++ b/Doc/library/struct.rst
@@ -240,10 +240,11 @@
 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.
-For packing, the string is truncated or padded with null bytes as appropriate to
-make it fit. For unpacking, the resulting bytes object always has exactly the
-specified number of bytes.  As a special case, ``'0s'`` means a single, empty
-string (while ``'0c'`` means 0 characters).
+If a count is not given, it defaults to 1.  For packing, the string is
+truncated or padded with null bytes as appropriate to make it fit. For
+unpacking, the resulting bytes object always has exactly the specified number
+of bytes.  As a special case, ``'0s'`` means a single, empty string (while
+``'0c'`` means 0 characters).
 
 When packing a value ``x`` using one of the integer formats (``'b'``,
 ``'B'``, ``'h'``, ``'H'``, ``'i'``, ``'I'``, ``'l'``, ``'L'``,

-- 
Repository URL: http://hg.python.org/cpython


More information about the Python-checkins mailing list