[New-bugs-announce] [issue17804] streaming struct unpacking

Antoine Pitrou report at bugs.python.org
Sat Apr 20 22:33:23 CEST 2013

New submission from Antoine Pitrou:

For certain applications, you want to unpack repeatedly the same pattern. This came in issue17618 (base85 decoding), where you want to unpack a stream of bytes as 32-bit big-endian unsigned ints. The solution adopted in issue17618 patch (struct.Struct("!{}I")) is clearly suboptimal.

I would suggest something like a iter_unpack() function which would repeatedly yield tuples until the bytes object is over.

components: Library (Lib)
messages: 187455
nosy: mark.dickinson, meador.inge, pitrou, serhiy.storchaka
priority: normal
severity: normal
status: open
title: streaming struct unpacking
type: enhancement
versions: Python 3.4

Python tracker <report at bugs.python.org>

More information about the New-bugs-announce mailing list