Skip to content

Commit 40df344

Browse files
committed
Update per review comments
1 parent 976045e commit 40df344

File tree

1 file changed

+2
-10
lines changed

1 file changed

+2
-10
lines changed

Doc/library/contextlib.rst

Lines changed: 2 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -330,9 +330,7 @@ Functions and classes provided:
330330
another :term:`file object`.
331331

332332
This tool adds flexibility to existing functions or classes whose output
333-
is hardwired to :data:`sys.stdout`. This does not modify underlying file
334-
objects or file descriptors. It sets the global :data:`sys.stdout` to the
335-
provided value and at context exit sets it to the previous value.
333+
is hardwired to :data:`sys.stdout`.
336334

337335
For example, the output of :func:`help` normally is sent to *sys.stdout*.
338336
You can capture that output in a string by redirecting the output to an
@@ -356,12 +354,6 @@ Functions and classes provided:
356354
with redirect_stdout(sys.stderr):
357355
help(pow)
358356

359-
To discard or suppress the output of :func:`help` without collecting the data::
360-
361-
with open(os.devnull, 'w') as devnull:
362-
with redirect_stdout(devnull):
363-
help(pow)
364-
365357
Note that the global side effect on :data:`sys.stdout` means that this
366358
context manager is not suitable for use in library code and most threaded
367359
applications. It also has no effect on the output of subprocesses.
@@ -375,7 +367,7 @@ Functions and classes provided:
375367
.. function:: redirect_stderr(new_target)
376368

377369
Similar to :func:`~contextlib.redirect_stdout` but redirecting the global
378-
:data:`sys.stderr` to another value, typically a :term:`file object`.
370+
:data:`sys.stderr` to another :term:`file object`.
379371

380372
This context manager is :ref:`reentrant <reentrant-cms>`.
381373

0 commit comments

Comments
 (0)