Commits

Ezio Melotti committed 6467836

#18796: improve documentation of the file argument of dis.show_code. Initial patch by Vajrasky Kok.

  • Participants
  • Parent commits c0e9ba7

Comments (0)

Files changed (2)

Doc/library/dis.rst

 .. function:: show_code(x, *, file=None)
 
    Print detailed code object information for the supplied function, method,
-   source code string or code object to stdout.
+   source code string or code object to *file* (or ``sys.stdout`` if *file*
+   is not specified).
 
    This is a convenient shorthand for ``print(code_info(x), file=file)``,
    intended for interactive exploration at the interpreter prompt.
     return "\n".join(lines)
 
 def show_code(co, *, file=None):
-    """Print details of methods, functions, or code to stdout."""
+    """Print details of methods, functions, or code to *file*.
+
+    If *file* is not provided, the output is printed on stdout.
+    """
     print(code_info(co), file=file)
 
 _Instruction = collections.namedtuple("_Instruction",