Joe Jevnik added the comment:

The recipe you showed looks like it is very complicated for the expected use 
case of decompressing all of the data into a mutable buffer. One difference I 
see with this and struct.pack_into or socket.recv_into is that in both of those 
cases we know how large our buffer needs to be. With zlib.decompress there is 
not a simple way for users to preallocate a buffer to hold the result and need 
to resort to some looping with a lot of resizes. I think that returning either 
a mutable or immutable buffer hits 95% of use cases. If we go with the 
decompress_into method I would strongly advise putting decompress_as_bytearray 
into the standard library so that users do not need write this themselves.

Thank you for pointing me at the bz2 and LZMA modules. When we come to an 
agreement on the API I will update bz2 and LZMA so that they match. Should I 
also update the gzip module?

----------

_______________________________________
Python tracker <rep...@bugs.python.org>
<http://bugs.python.org/issue26379>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to