On 27Dec2018 02:53, Anders Hovmöller <bo...@killingar.net> wrote:
And this is why I, personally, think augumenting struct.unpack and json.read
and a myriad of other arbitrary methods to accept both file-like things and
bytes is an open ended can of worms.
And it is why I wrote myself my CornuCopyBuffer class (see my other post in
this thread).
Seems like that should be in the standard library then!
It is insufficiently used at present. The idea seems sound - a flexible
adapter of bytes sources providing easy methods to aid parsing - based
on how useful it has been to me. But it has rough edges and one needs to
convince others of its utility before entry into the stdlib.
So it is on PyPI for easy use.
If you're in the binary I/O/parsing space, pip install it (and
cs.binary, which utilises it) and see how they work for you. Complain to
me about poor semantics or bugs. And then we'll see how general purpose
it really is. The PyPI package pages for each have doco derived from the
module docstrings.
Cheers,
Cameron Simpson <c...@cskk.id.au>
_______________________________________________
Python-ideas mailing list
Python-ideas@python.org
https://mail.python.org/mailman/listinfo/python-ideas
Code of Conduct: http://python.org/psf/codeofconduct/