~pythonregexp2.7/python/issue2636-17

« back to all changes in this revision

Viewing changes to Doc/library/struct.rst

  • Committer: benjamin.peterson
  • Date: 2008-04-25 01:29:10 UTC
  • Revision ID: svn-v3-trunk1:6015fed2-1504-0410-9fe1-9d1591cc4771:python%2Ftrunk:62490
reformat some documentation of classes so methods and attributes are under the class directive

Show diffs side-by-side

added added

removed removed

Lines of Context:
260
260
 
261
261
   .. versionadded:: 2.5
262
262
 
263
 
Compiled Struct objects support the following methods and attributes:
264
 
 
265
 
 
266
 
.. method:: Struct.pack(v1, v2, ...)
267
 
 
268
 
   Identical to the :func:`pack` function, using the compiled format.
269
 
   (``len(result)`` will equal :attr:`self.size`.)
270
 
 
271
 
 
272
 
.. method:: Struct.pack_into(buffer, offset, v1, v2, ...)
273
 
 
274
 
   Identical to the :func:`pack_into` function, using the compiled format.
275
 
 
276
 
 
277
 
.. method:: Struct.unpack(string)
278
 
 
279
 
   Identical to the :func:`unpack` function, using the compiled format.
280
 
   (``len(string)`` must equal :attr:`self.size`).
281
 
 
282
 
 
283
 
.. method:: Struct.unpack_from(buffer[, offset=0])
284
 
 
285
 
   Identical to the :func:`unpack_from` function, using the compiled format.
286
 
   (``len(buffer[offset:])`` must be at least :attr:`self.size`).
287
 
 
288
 
 
289
 
.. attribute:: Struct.format
290
 
 
291
 
   The format string used to construct this Struct object.
292
 
 
293
 
.. attribute:: Struct.size
294
 
 
295
 
   The calculated size of the struct (and hence of the string) corresponding
296
 
   to :attr:`format`.
 
263
   Compiled Struct objects support the following methods and attributes:
 
264
 
 
265
 
 
266
   .. method:: pack(v1, v2, ...)
 
267
 
 
268
      Identical to the :func:`pack` function, using the compiled format.
 
269
      (``len(result)`` will equal :attr:`self.size`.)
 
270
 
 
271
 
 
272
   .. method:: pack_into(buffer, offset, v1, v2, ...)
 
273
 
 
274
      Identical to the :func:`pack_into` function, using the compiled format.
 
275
 
 
276
 
 
277
   .. method:: unpack(string)
 
278
 
 
279
      Identical to the :func:`unpack` function, using the compiled format.
 
280
      (``len(string)`` must equal :attr:`self.size`).
 
281
 
 
282
 
 
283
   .. method:: unpack_from(buffer[, offset=0])
 
284
 
 
285
      Identical to the :func:`unpack_from` function, using the compiled format.
 
286
      (``len(buffer[offset:])`` must be at least :attr:`self.size`).
 
287
 
 
288
 
 
289
   .. attribute:: format
 
290
 
 
291
      The format string used to construct this Struct object.
 
292
 
 
293
   .. attribute:: size
 
294
 
 
295
      The calculated size of the struct (and hence of the string) corresponding
 
296
      to :attr:`format`.
297
297