diff options
author | Georg Brandl <georg@python.org> | 2010-10-06 09:17:24 +0000 |
---|---|---|
committer | Georg Brandl <georg@python.org> | 2010-10-06 09:17:24 +0000 |
commit | e85e1ae413d28e78d66a7b74d68f08895479543f (patch) | |
tree | 849669a63355f08a22b180468a45afcb94a794c6 /Doc/library/struct.rst | |
parent | 41b986c35237ba0c05aac262fc31f4a40fb57c52 (diff) | |
download | cpython-git-e85e1ae413d28e78d66a7b74d68f08895479543f.tar.gz |
Merged revisions 82757-82758,82760-82764 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/branches/py3k
........
r82757 | georg.brandl | 2010-07-10 10:58:37 +0200 (Sa, 10 Jul 2010) | 1 line
Fix markup.
........
r82758 | georg.brandl | 2010-07-10 12:23:40 +0200 (Sa, 10 Jul 2010) | 1 line
Emphasize role of count for Pascal string.
........
r82760 | georg.brandl | 2010-07-10 12:39:57 +0200 (Sa, 10 Jul 2010) | 1 line
#3214: improve description of duck-typing in glossary.
........
r82761 | georg.brandl | 2010-07-10 13:40:13 +0200 (Sa, 10 Jul 2010) | 1 line
#1434090: properly append child in expatbuilder doctype handler.
........
r82762 | georg.brandl | 2010-07-10 13:51:06 +0200 (Sa, 10 Jul 2010) | 1 line
#8338: fix outdated class name.
........
r82763 | georg.brandl | 2010-07-10 14:01:34 +0200 (Sa, 10 Jul 2010) | 1 line
#8456: fix signature of sqlite3.connect().
........
r82764 | georg.brandl | 2010-07-10 14:20:38 +0200 (Sa, 10 Jul 2010) | 1 line
#8564: update docs on integrating doctest/unittest with unittest(2) test discovery.
........
Diffstat (limited to 'Doc/library/struct.rst')
-rw-r--r-- | Doc/library/struct.rst | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/Doc/library/struct.rst b/Doc/library/struct.rst index b5fd43278f..0b8052c40d 100644 --- a/Doc/library/struct.rst +++ b/Doc/library/struct.rst @@ -263,14 +263,14 @@ specified number of bytes. As a special case, ``'0s'`` means a single, empty string (while ``'0c'`` means 0 characters). The ``'p'`` format character encodes a "Pascal string", meaning a short -variable-length string stored in a fixed number of bytes. The count is the total -number of bytes stored. The first byte stored is the length of the string, or -255, whichever is smaller. The bytes of the string follow. If the string -passed in to :func:`pack` is too long (longer than the count minus 1), only the -leading count-1 bytes of the string are stored. If the string is shorter than -count-1, it is padded with null bytes so that exactly count bytes in all are -used. Note that for :func:`unpack`, the ``'p'`` format character consumes count -bytes, but that the string returned can never contain more than 255 characters. +variable-length string stored in a *fixed number of bytes*, given by the count. +The first byte stored is the length of the string, or 255, whichever is smaller. +The bytes of the string follow. If the string passed in to :func:`pack` is too +long (longer than the count minus 1), only the leading ``count-1`` bytes of the +string are stored. If the string is shorter than ``count-1``, it is padded with +null bytes so that exactly count bytes in all are used. Note that for +:func:`unpack`, the ``'p'`` format character consumes count bytes, but that the +string returned can never contain more than 255 characters. For the ``'P'`` format character, the return value is a Python integer or long integer, depending on the size needed to hold a pointer when it has been cast to |