summaryrefslogtreecommitdiffstats
path: root/Doc
diff options
context:
space:
mode:
authorR David Murray <rdmurray@bitdance.com>2014-02-26 17:46:19 (GMT)
committerR David Murray <rdmurray@bitdance.com>2014-02-26 17:46:19 (GMT)
commitbdf5efa10c922f86c9d49f006b833ab7a9e44538 (patch)
tree49fbfd4607850b6024090b76556e68e0a29417ba /Doc
parent80ebf6d17103e29ff861b429d8c7b51aac18b1f3 (diff)
downloadcpython-bdf5efa10c922f86c9d49f006b833ab7a9e44538.zip
cpython-bdf5efa10c922f86c9d49f006b833ab7a9e44538.tar.gz
cpython-bdf5efa10c922f86c9d49f006b833ab7a9e44538.tar.bz2
whatsnew: reword the contextlib.redirect_stdout entry for increased clarity.
Diffstat (limited to 'Doc')
-rw-r--r--Doc/whatsnew/3.4.rst14
1 files changed, 9 insertions, 5 deletions
diff --git a/Doc/whatsnew/3.4.rst b/Doc/whatsnew/3.4.rst
index c853ffd..fc9ca13 100644
--- a/Doc/whatsnew/3.4.rst
+++ b/Doc/whatsnew/3.4.rst
@@ -580,11 +580,15 @@ statement. (Contributed by Raymond Hettinger in :issue:`15806` and
Zero Piraeus in :issue:`19266`)
The new :func:`contextlib.redirect_stdout` context manager makes it easier
-for utility scripts to handle inflexible APIs that don't provide any
-options to retrieve their output as a string or direct it to somewhere
-other than :data:`sys.stdout`. In conjunction with :class:`io.StringIO`,
-this context manager is also useful for checking expected output from
-command line utilities. (Contribute by Raymond Hettinger in :issue:`15805`)
+for utility scripts to handle inflexible APIs that write their output to
+:data:`sys.stdout` and don't provide any options to redirect it. Using the
+context manager, the :data:`sys.stdout` output can be redirected to any
+other stream or, in conjunction with :class:`io.StringIO`, to a string.
+The latter can be especially useful, for example, to capture output
+from a function that was written to implement a command line interface.
+It is recommended only for utility scripts because it affects the
+global state of :data:`sys.stdout`. (Contributed by Raymond Hettinger
+in :issue:`15805`)
The :mod:`contextlib` documentation has also been updated to include a
:ref:`discussion <single-use-reusable-and-reentrant-cms>` of the