]> granicus.if.org Git - python/commitdiff
#18796: improve documentation of the file argument of dis.show_code. Initial patch...
authorEzio Melotti <ezio.melotti@gmail.com>
Fri, 23 Aug 2013 19:41:39 +0000 (22:41 +0300)
committerEzio Melotti <ezio.melotti@gmail.com>
Fri, 23 Aug 2013 19:41:39 +0000 (22:41 +0300)
Doc/library/dis.rst
Lib/dis.py

index 468ce92cf19594d37673fa5675e59c4ae70d8a78..a546f68df0977486e56cd645ba4ea3f3f0bd81fb 100644 (file)
@@ -109,7 +109,8 @@ object isn't useful:
 .. 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.
index ca4094c1bb7f3453647b45094db4734e20e602e6..0d62c0828ccf67fd3520943590f09e4805be9ab6 100644 (file)
@@ -146,7 +146,10 @@ def _format_code_info(co):
     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",