This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author mfbarnes
Recipients
Date 2003-11-23.22:24:00
SpamBayes Score
Marked as misclassified
Message-id
In-reply-to
Content
This patch extends the struct.unpack format notation to
be able to express groups of data with parentheses.

For example:

>>> data = struct.pack('iiii', 1, 2, 3, 4)
>>> struct.unpack('i(ii)i', data)
(1, (2, 3), 4)

Integral repeat counts can also be applied to groups.

>>> struct.unpack('2(ii)', data)
((1, 2), (3, 4))

In addition, struct.calcsize also handles parentheses
in format strings correctly.

>>> struct.calcsize('4(ii)')
32

No changes were made to struct.pack.  It still treats
parentheses as illegal format characters.

I have not yet updated any documentation or tests
associated with struct.calcsize or struct.unpack.
History
Date User Action Args
2007-08-23 15:29:54adminlinkissue847857 messages
2007-08-23 15:29:54admincreate