Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 6ef9a84

Browse files
committed
factor out constant
1 parent 061913e commit 6ef9a84

1 file changed

Lines changed: 3 additions & 2 deletions

File tree

Lib/dis.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,8 @@
1010
"findlinestarts", "findlabels"] + _opcodes_all
1111
del _opcodes_all
1212

13+
_have_code = (types.MethodType, types.FunctionType, types.CodeType, type)
14+
1315
def dis(x=None):
1416
"""Disassemble classes, methods, functions, or code.
1517
@@ -26,8 +28,7 @@ def dis(x=None):
2628
if hasattr(x, '__dict__'):
2729
items = sorted(x.__dict__.items())
2830
for name, x1 in items:
29-
if isinstance(x1, (types.MethodType, types.FunctionType,
30-
types.CodeType, type)):
31+
if isinstance(x1, _have_code):
3132
print("Disassembly of %s:" % name)
3233
try:
3334
dis(x1)

0 commit comments

Comments
 (0)