[Python-checkins] cpython: #18796: improve documentation of the file argument of dis.show_code. Initial

ezio.melotti python-checkins at python.org
Fri Aug 23 21:41:58 CEST 2013


http://hg.python.org/cpython/rev/64678369c4d0
changeset: 85349:64678369c4d0
user: Ezio Melotti <ezio.melotti at gmail.com>
date: Fri Aug 23 22:41:39 2013 +0300
summary:
 #18796: improve documentation of the file argument of dis.show_code. Initial patch by Vajrasky Kok.
files:
 Doc/library/dis.rst | 3 ++-
 Lib/dis.py | 5 ++++-
 2 files changed, 6 insertions(+), 2 deletions(-)
diff --git a/Doc/library/dis.rst b/Doc/library/dis.rst
--- a/Doc/library/dis.rst
+++ b/Doc/library/dis.rst
@@ -109,7 +109,8 @@
 .. 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.
diff --git a/Lib/dis.py b/Lib/dis.py
--- a/Lib/dis.py
+++ b/Lib/dis.py
@@ -146,7 +146,10 @@
 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",
-- 
Repository URL: http://hg.python.org/cpython


More information about the Python-checkins mailing list

AltStyle によって変換されたページ (->オリジナル) /