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 rhettinger
Recipients Elizacat, cameron, ethan.furman, mark.dickinson, pitrou, rhettinger, serhiy.storchaka, yselivanov
Date 2017-01-23.08:33:53
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1485160433.7.0.866065729711.issue29328@psf.upfronthosting.co.za>
In-reply-to
Content
FWIW, the existence of netstruct https://github.com/stendec/netstruct does at least show that a coherent proposal is possible (the docs provide an API, motivation and examples).

One question is whether this could be implemented in the stdlib struct module without major brain surgery to the existing code which is organized around an initial prepare_s() step whose output is a PyStructObject which includes a fixed s_size field.  The various parsing routines all depend on the s_size field.  Where this proposal would require too much of a total rewrite is likely only answerable by someone building a patch with tests and real-world examples.

Another question is whether supporting variable length input would be better served by providing an alternative API that is better designed for it.  For example, unpack(fmt, input_stream or iterator, limit=None) which would consume as many bytes as needed from the input stream with an optional limit.  This would be nicer than having to figure-out in advance how to extract an input string of the appropriate size.

A last question is whether this should remain outside the standard library.  With PyPI becoming so rich and easy to access, we're often deciding that code is better-off outside the standard library where it can flourish in a more fluid environment.
History
Date User Action Args
2017-01-23 08:33:53rhettingersetrecipients: + rhettinger, mark.dickinson, pitrou, cameron, ethan.furman, serhiy.storchaka, yselivanov, Elizacat
2017-01-23 08:33:53rhettingersetmessageid: <1485160433.7.0.866065729711.issue29328@psf.upfronthosting.co.za>
2017-01-23 08:33:53rhettingerlinkissue29328 messages
2017-01-23 08:33:53rhettingercreate