diff options
Diffstat (limited to 'Doc/library/sys.rst')
-rw-r--r-- | Doc/library/sys.rst | 20 |
1 files changed, 12 insertions, 8 deletions
diff --git a/Doc/library/sys.rst b/Doc/library/sys.rst index c29e7fe..29f3313 100644 --- a/Doc/library/sys.rst +++ b/Doc/library/sys.rst @@ -780,16 +780,20 @@ always available. __stderr__ These objects contain the original values of ``stdin``, ``stderr`` and - ``stdout`` at the start of the program. They are used during finalization, and - could be useful to restore the actual files to known working file objects in - case they have been overwritten with a broken object. + ``stdout`` at the start of the program. They are used during finalization, + and could be useful to print to the actual standard stream no matter if the + ``sys.std*`` object has been redirected. - .. note:: + It can also be used to restore the actual files to known working file objects + in case they have been overwritten with a broken object. However, the + preferred way to do this is to explicitly save the previous stream before + replacing it, and restore the saved object. - Under some conditions ``stdin``, ``stdout`` and ``stderr`` as well as the - original values ``__stdin__``, ``__stdout__`` and ``__stderr__`` can be - None. It is usually the case for Windows GUI apps that aren't connected to - a console and Python apps started with :program:`pythonw`. + .. note:: + Under some conditions ``stdin``, ``stdout`` and ``stderr`` as well as the + original values ``__stdin__``, ``__stdout__`` and ``__stderr__`` can be + None. It is usually the case for Windows GUI apps that aren't connected + to a console and Python apps started with :program:`pythonw`. .. data:: tracebacklimit |