summaryrefslogtreecommitdiffstats
path: root/Lib/dis.py
diff options
context:
space:
mode:
authorNick Coghlan <ncoghlan@gmail.com>2010-09-10 14:08:04 (GMT)
committerNick Coghlan <ncoghlan@gmail.com>2010-09-10 14:08:04 (GMT)
commite8814fbb322ee6555a96dd8e173259c9c3b6a01a (patch)
tree8b1dde00a7588fc760ec576b7e185ad954df8615 /Lib/dis.py
parentc02adca9996026c9f84a0e9079042dad27e3738a (diff)
downloadcpython-e8814fbb322ee6555a96dd8e173259c9c3b6a01a.zip
cpython-e8814fbb322ee6555a96dd8e173259c9c3b6a01a.tar.gz
cpython-e8814fbb322ee6555a96dd8e173259c9c3b6a01a.tar.bz2
As per python-dev discussion with Eli, properly document and publish dis.show_code
Diffstat (limited to 'Lib/dis.py')
-rw-r--r--Lib/dis.py8
1 files changed, 2 insertions, 6 deletions
diff --git a/Lib/dis.py b/Lib/dis.py
index 1f56014..f64bae6 100644
--- a/Lib/dis.py
+++ b/Lib/dis.py
@@ -7,7 +7,7 @@ from opcode import *
from opcode import __all__ as _opcodes_all
__all__ = ["code_info", "dis", "disassemble", "distb", "disco",
- "findlinestarts", "findlabels"] + _opcodes_all
+ "findlinestarts", "findlabels", "show_code"] + _opcodes_all
del _opcodes_all
_have_code = (types.MethodType, types.FunctionType, types.CodeType, type)
@@ -140,12 +140,8 @@ def _format_code_info(co):
lines.append("%4d: %s" % i_n)
return "\n".join(lines)
-# show_code is deliberately undocumented and left out of __all__,
-# since it doesn't offer any real benefit over code_info() above
-# It is only retained because it already existed and was not
-# marked as private in previous versions of Python
def show_code(co):
- """Show details about a code object."""
+ """Print details of methods, functions, or code to stdout."""
print(code_info(co))
def disassemble(co, lasti=-1):