Compression module APIs

Chris Rebert clp2 at rebertia.com
Thu May 6 07:37:21 EDT 2010


On Thu, May 6, 2010 at 4:09 AM, Florian Weimer <fw at deneb.enyo.de> wrote:
> As far as I can see, the compression-related APIs (gzip, zlib, bzip2)
> in Python 2.5 have three distinct APIs.  Is there really no unified
> interface, or am I missing something?

bz2.BZ2File and gzip.GzipFile both offer a file-like interface for
reading/writing compressed files in their respective formats.
The gzip module is already built on top of the zlib module, so there's
no ZlibFile.
zlib and bz2 also both offer compatible one-shot compress() and
decompress() functions.
So, the interfaces are sorta "unified", although it is true they're
not grouped into a single generic "compression" module.

Cheers,
Chris
--
http://blog.rebertia.com



More information about the Python-list mailing list