diff options
author | Antoine Pitrou <solipsis@pitrou.net> | 2010-10-04 21:55:14 +0000 |
---|---|---|
committer | Antoine Pitrou <solipsis@pitrou.net> | 2010-10-04 21:55:14 +0000 |
commit | 7f442969f437eb011d935213141ff3d3c6fe930e (patch) | |
tree | 3dff2ac4cfaafc1d6cb8669c8891de5905ce8a4c /Doc/library/gzip.rst | |
parent | 64d6739e8f6bc6ebf5417124e592e8c750385871 (diff) | |
download | cpython-7f442969f437eb011d935213141ff3d3c6fe930e.tar.gz |
GzipFile.peek improvements, suggested by Nir Aides.
Diffstat (limited to 'Doc/library/gzip.rst')
-rw-r--r-- | Doc/library/gzip.rst | 14 |
1 files changed, 11 insertions, 3 deletions
diff --git a/Doc/library/gzip.rst b/Doc/library/gzip.rst index 0ae23d2d6b..82f10b9ecd 100644 --- a/Doc/library/gzip.rst +++ b/Doc/library/gzip.rst @@ -70,6 +70,17 @@ The module defines the following items: including iteration and the :keyword:`with` statement. Only the :meth:`truncate` method isn't implemented. + :class:`GzipFile` also provides the following method: + + .. method:: peek([n]) + + Read *n* uncompressed bytes without advancing the file position. + At most one single read on the compressed stream is done to satisfy + the call. The number of bytes returned may be more or less than + requested. + + .. versionadded:: 3.2 + .. versionchanged:: 3.1 Support for the :keyword:`with` statement was added. @@ -79,9 +90,6 @@ The module defines the following items: .. versionchanged:: 3.2 Support for unseekable files was added. - .. versionchanged:: 3.2 - The :meth:`peek` method was implemented. - .. function:: open(filename, mode='rb', compresslevel=9) |