summaryrefslogtreecommitdiffstats
path: root/Lib
diff options
context:
space:
mode:
authorNadeem Vawda <nadeem.vawda@gmail.com>2012-11-11 13:04:14 (GMT)
committerNadeem Vawda <nadeem.vawda@gmail.com>2012-11-11 13:04:14 (GMT)
commit19e568d254bea8202703302d0ada9bc93f99331a (patch)
tree74dfb24f4c4a14b1f4ed963a22df688bc1f13abc /Lib
parent12489d98e692717a93694644dac4975d54106178 (diff)
downloadcpython-19e568d254bea8202703302d0ada9bc93f99331a.zip
cpython-19e568d254bea8202703302d0ada9bc93f99331a.tar.gz
cpython-19e568d254bea8202703302d0ada9bc93f99331a.tar.bz2
Issue #15677: Document that zlib and gzip accept a compression level of 0 to mean 'no compression'.
Patch by Brian Brazil.
Diffstat (limited to 'Lib')
-rw-r--r--Lib/gzip.py7
1 files changed, 4 insertions, 3 deletions
diff --git a/Lib/gzip.py b/Lib/gzip.py
index e1b43a5..403040b 100644
--- a/Lib/gzip.py
+++ b/Lib/gzip.py
@@ -137,9 +137,10 @@ class GzipFile(io.BufferedIOBase):
A mode of 'r' is equivalent to one of 'rb', and similarly for 'w' and
'wb', and 'a' and 'ab'.
- The compresslevel argument is an integer from 1 to 9 controlling the
+ The compresslevel argument is an integer from 0 to 9 controlling the
level of compression; 1 is fastest and produces the least compression,
- and 9 is slowest and produces the most compression. The default is 9.
+ and 9 is slowest and produces the most compression. 0 is no compression
+ at all. The default is 9.
The mtime argument is an optional numeric timestamp to be written
to the stream when compressing. All gzip compressed streams
@@ -573,7 +574,7 @@ class GzipFile(io.BufferedIOBase):
def compress(data, compresslevel=9):
"""Compress data in one shot and return the compressed string.
- Optional argument is the compression level, in range of 1-9.
+ Optional argument is the compression level, in range of 0-9.
"""
buf = io.BytesIO()
with GzipFile(fileobj=buf, mode='wb', compresslevel=compresslevel) as f: