Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code | Sign in
(86)

Side by Side Diff: Doc/library/struct.rst

Issue 10639: reindent.py converts newlines to platform default
Patch Set: Created 8 years, 8 months ago
Left:
Right:
Use n/p to move between diff chunks; N/P to move between comments. Please Sign in to add in-line comments.
Jump to:
View unified diff | Download patch
« no previous file with comments | « Doc/library/stdtypes.rst ('k') | Doc/library/subprocess.rst » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 :mod:`struct` --- Interpret bytes as packed binary data 1 :mod:`struct` --- Interpret bytes as packed binary data
2 ======================================================= 2 =======================================================
3 3
4 .. module:: struct 4 .. module:: struct
5 :synopsis: Interpret bytes as packed binary data. 5 :synopsis: Interpret bytes as packed binary data.
6 6
7 .. index:: 7 .. index::
8 pair: C; structures 8 pair: C; structures
9 triple: packing; binary; data 9 triple: packing; binary; data
10 10
(...skipping 222 matching lines...) Expand 10 before | Expand all | Expand 10 after
233 233
234 A format character may be preceded by an integral repeat count. For example, 234 A format character may be preceded by an integral repeat count. For example,
235 the format string ``'4h'`` means exactly the same as ``'hhhh'``. 235 the format string ``'4h'`` means exactly the same as ``'hhhh'``.
236 236
237 Whitespace characters between formats are ignored; a count and its format must 237 Whitespace characters between formats are ignored; a count and its format must
238 not contain whitespace though. 238 not contain whitespace though.
239 239
240 For the ``'s'`` format character, the count is interpreted as the length of the 240 For the ``'s'`` format character, the count is interpreted as the length of the
241 bytes, not a repeat count like for the other format characters; for example, 241 bytes, not a repeat count like for the other format characters; for example,
242 ``'10s'`` means a single 10-byte string, while ``'10c'`` means 10 characters. 242 ``'10s'`` means a single 10-byte string, while ``'10c'`` means 10 characters.
243 If a count is not given, it defaults to 1. For packing, the string is 243 For packing, the string is truncated or padded with null bytes as appropriate to
244 truncated or padded with null bytes as appropriate to make it fit. For 244 make it fit. For unpacking, the resulting bytes object always has exactly the
245 unpacking, the resulting bytes object always has exactly the specified number 245 specified number of bytes. As a special case, ``'0s'`` means a single, empty
246 of bytes. As a special case, ``'0s'`` means a single, empty string (while 246 string (while ``'0c'`` means 0 characters).
247 ``'0c'`` means 0 characters).
248 247
249 When packing a value ``x`` using one of the integer formats (``'b'``, 248 When packing a value ``x`` using one of the integer formats (``'b'``,
250 ``'B'``, ``'h'``, ``'H'``, ``'i'``, ``'I'``, ``'l'``, ``'L'``, 249 ``'B'``, ``'h'``, ``'H'``, ``'i'``, ``'I'``, ``'l'``, ``'L'``,
251 ``'q'``, ``'Q'``), if ``x`` is outside the valid range for that format 250 ``'q'``, ``'Q'``), if ``x`` is outside the valid range for that format
252 then :exc:`struct.error` is raised. 251 then :exc:`struct.error` is raised.
253 252
254 .. versionchanged:: 3.1 253 .. versionchanged:: 3.1
255 In 3.0, some of the integer formats wrapped out-of-range values and 254 In 3.0, some of the integer formats wrapped out-of-range values and
256 raised :exc:`DeprecationWarning` instead of :exc:`struct.error`. 255 raised :exc:`DeprecationWarning` instead of :exc:`struct.error`.
257 256
(...skipping 119 matching lines...) Expand 10 before | Expand all | Expand 10 after
377 376
378 .. attribute:: format 377 .. attribute:: format
379 378
380 The format string used to construct this Struct object. 379 The format string used to construct this Struct object.
381 380
382 .. attribute:: size 381 .. attribute:: size
383 382
384 The calculated size of the struct (and hence of the bytes object produced 383 The calculated size of the struct (and hence of the bytes object produced
385 by the :meth:`pack` method) corresponding to :attr:`format`. 384 by the :meth:`pack` method) corresponding to :attr:`format`.
386 385
OLDNEW
« no previous file with comments | « Doc/library/stdtypes.rst ('k') | Doc/library/subprocess.rst » ('j') | no next file with comments »

RSS Feeds Recent Issues | This issue
This is Rietveld 894c83f36cb7+