From bec94cb8c0e379040a0b6c237fbe2900c2f7ff72 Mon Sep 17 00:00:00 2001 From: Wirawan Purwanto Date: Fri, 3 Apr 2015 16:09:37 -0400 Subject: [PATCH] * Documentation update. --- py/stdout_capture.py | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/py/stdout_capture.py b/py/stdout_capture.py index af2aed7..837d1a8 100644 --- a/py/stdout_capture.py +++ b/py/stdout_capture.py @@ -12,6 +12,18 @@ wpylib.py.stdout_capture Capture tool for sys.stdout output, for interactive uses (primarily, so that the output from sys.stdout is recorded to an ipython log file). +Example uses: + +1) redirecting stdout explicitly + + from wpylib.py.stdout_capture import StdoutCapture + xstdout = StdoutCapture() + # the original command was: fc.calculate_and_print_energy(h, UHF_01, UHF_01, out=sys.stdout) + # ^^^^^^^^^^^^^^ + # this now becomes: + xstdout(fc.calculate_and_print_energy, h, UHF_01, UHF_01, out=xstdout.stdout) + + Original-source: `ipython_common.py`. """ @@ -19,7 +31,7 @@ import sys class StdoutCapture(object): """Capture tool for sys.stdout output, for interactive uses (primarily, -so that the output from sys.stdout is recorded to an ipython log file). + so that the output from sys.stdout is recorded to an ipython log file). """ class outfile_proxy(object):