Commit 7403656b authored by Benjamin Peterson's avatar Benjamin Peterson

factor out constant

parent 5f784a67
......@@ -10,6 +10,8 @@ __all__ = ["dis", "disassemble", "distb", "disco",
"findlinestarts", "findlabels"] + _opcodes_all
del _opcodes_all
_have_code = (types.MethodType, types.FunctionType, types.CodeType, type)
def dis(x=None):
"""Disassemble classes, methods, functions, or code.
......@@ -26,8 +28,7 @@ def dis(x=None):
if hasattr(x, '__dict__'):
items = sorted(x.__dict__.items())
for name, x1 in items:
if isinstance(x1, (types.MethodType, types.FunctionType,
types.CodeType, type)):
if isinstance(x1, _have_code):
print("Disassembly of %s:" % name)
try:
dis(x1)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment