Tweak around docstring to make prettier sphinx autodocs.
[python_utils.git] / string_utils.py
index a2f46332156e0c5fc41f3db8a8228a149272651c..dbd50f22bbe48b349dd69649f480a557cb7ba1c7 100644 (file)
@@ -1246,13 +1246,18 @@ def strip_ansi_sequences(in_str: str) -> str:
 
 class SprintfStdout(contextlib.AbstractContextManager):
     """
-    A context manager that captures outputs to stdout.
+    A context manager that captures outputs to stdout to a buffer
+    without printing them.  e.g.::
 
-    with SprintfStdout() as buf:
-        print("test")
-    print(buf())
+        with SprintfStdout() as buf:
+            print("test")
+            print("1, 2, 3")
+        print(buf())
+
+    This yields::
+
+        'test\\n1, 2, 3\\n'
 
-    'test\n'
     """
 
     def __init__(self) -> None: