summaryrefslogtreecommitdiffstats
path: root/Doc
diff options
context:
space:
mode:
authorBenjamin Peterson <benjamin@python.org>2009-03-09 20:38:56 (GMT)
committerBenjamin Peterson <benjamin@python.org>2009-03-09 20:38:56 (GMT)
commit6d83429a1dea00667357fc8360cdb1ce56521def (patch)
tree30b76a09dcf9972a1372aef970a4643364712711 /Doc
parent38f1bf6745d8270e748f0c572421fdbdcacd274a (diff)
downloadcpython-6d83429a1dea00667357fc8360cdb1ce56521def.zip
cpython-6d83429a1dea00667357fc8360cdb1ce56521def.tar.gz
cpython-6d83429a1dea00667357fc8360cdb1ce56521def.tar.bz2
gzip and bz2 are context managers
Diffstat (limited to 'Doc')
-rw-r--r--Doc/library/bz2.rst5
-rw-r--r--Doc/library/gzip.rst5
2 files changed, 10 insertions, 0 deletions
diff --git a/Doc/library/bz2.rst b/Doc/library/bz2.rst
index 7804c54..fa6d762 100644
--- a/Doc/library/bz2.rst
+++ b/Doc/library/bz2.rst
@@ -60,6 +60,11 @@ Handling of compressed files is offered by the :class:`BZ2File` class.
reading. Instances support iteration in the same way as normal :class:`file`
instances.
+ :class:`BZ2File` supports the :keyword:`with` statement.
+
+ .. versionchanged:: 2.7
+ Support for the :keyword:`with` statement was added.
+
.. method:: close()
diff --git a/Doc/library/gzip.rst b/Doc/library/gzip.rst
index 2be8e05..c76bae8 100644
--- a/Doc/library/gzip.rst
+++ b/Doc/library/gzip.rst
@@ -67,6 +67,11 @@ The module defines the following items:
writing as *fileobj*, and retrieve the resulting memory buffer using the
:class:`StringIO` object's :meth:`getvalue` method.
+ :class:`GzipFile` supports the :keyword:`with` statement.
+
+ .. versionchanged:: 2.7
+ Support for the :keyword:`with` statement was added.
+
.. function:: open(filename[, mode[, compresslevel]])