docs for extra params? co = zlib.compressobj(2, 8, -12, 9, 1)

Kalle Svensson kalle at gnupung.net
Wed May 30 14:57:36 EDT 2001


Sez Bengt Richter:
> This line appears in test_zlib.py:
> 
> 	co = zlib.compressobj(2, 8, -12, 9, 1)
> 
> A few others also:
> 
>   	  zlib.compressobj(1, 8, 0)
> 	co = zlib.compressobj(8, 8, -15)
> 
> The only call I see documented in
> 
> 	<YPathMV>Python21/Doc/lib/module-zlib.html
> 
> is
> 
> 	compressobj([level]) 

The arguments are parsed with:
if (!PyArg_ParseTuple(args, "|iiiii:compressobj", &level, &method, &wbits,
                      &memLevel, &strategy))

>From zlib.h:
"""
The method parameter is the compression method. It must be Z_DEFLATED in
this version of the library.
	
The windowBits parameter is the base two logarithm of the window size
(the size of the history buffer).  It should be in the range 8..15 for this
version of the library. Larger values of this parameter result in better
compression at the expense of memory usage. The default value is 15 if
deflateInit is used instead.
	 
The memLevel parameter specifies how much memory should be allocated
for the internal compression state. memLevel=1 uses minimum memory but
is slow and reduces compression ratio; memLevel=9 uses maximum memory
for optimal speed. The default value is 8. See zconf.h for total memory
usage as a function of windowBits and memLevel.
	 
The strategy parameter is used to tune the compression algorithm. Use the
value Z_DEFAULT_STRATEGY for normal data, Z_FILTERED for data produced by a
filter (or predictor), or Z_HUFFMAN_ONLY to force Huffman encoding only (no
string match).  Filtered data consists mostly of small values with a
somewhat random distribution. In this case, the compression algorithm is
tuned to compress them better. The effect of Z_FILTERED is to force more
Huffman coding and less string matching; it is somewhat intermediate
between Z_DEFAULT and Z_HUFFMAN_ONLY. The strategy parameter only affects
the compression ratio but not the correctness of the compressed output even
if it is not set appropriately.
"""

Peace,
  Kalle
-- 
Email: kalle at gnupung.net     | You can tune a filesystem, but you
Web: http://www.gnupung.net/ | can't tune a fish. -- man tunefs(8)
PGP fingerprint: 0C56 B171 8159 327F 1824 F5DE 74D7 80D7 BF3B B1DD
 [ Not signed due to lossage.  Blame Microsoft Outlook Express. ]




More information about the Python-list mailing list