diff options
Diffstat (limited to 'Doc/library/struct.rst')
-rw-r--r-- | Doc/library/struct.rst | 14 |
1 files changed, 9 insertions, 5 deletions
diff --git a/Doc/library/struct.rst b/Doc/library/struct.rst index 9ba4047..1a0fd73 100644 --- a/Doc/library/struct.rst +++ b/Doc/library/struct.rst @@ -118,11 +118,11 @@ order, and properly aligned by skipping pad bytes if necessary (according to the rules used by the C compiler). .. index:: - single: @; in struct format strings - single: =; in struct format strings - single: <; in struct format strings - single: >; in struct format strings - single: !; in struct format strings + single: @ (at); in struct format strings + single: = (equals); in struct format strings + single: < (less); in struct format strings + single: > (greater); in struct format strings + single: ! (exclamation); in struct format strings Alternatively, the first character of the format string can be used to indicate the byte order, size and alignment of the packed data, according to the @@ -247,6 +247,8 @@ platform-dependent. Notes: (1) + .. index:: single: ? (question mark); in struct format strings + The ``'?'`` conversion code corresponds to the :c:type:`_Bool` type defined by C99. If this type is not available, it is simulated using a :c:type:`char`. In standard mode, it is always represented by one byte. @@ -329,6 +331,8 @@ 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 bytes. +.. index:: single: ? (question mark); in struct format strings + For the ``'?'`` format character, the return value is either :const:`True` or :const:`False`. When packing, the truth value of the argument object is used. Either 0 or 1 in the native or standard bool representation will be packed, and |