mirror of
https://github.com/python/cpython.git
synced 2025-09-14 04:37:29 +00:00
use isinstance
This commit is contained in:
parent
e3f68a1a96
commit
e1577fb20f
1 changed files with 5 additions and 5 deletions
10
Lib/dis.py
10
Lib/dis.py
|
@ -19,7 +19,7 @@ def dis(x=None):
|
|||
if x is None:
|
||||
distb()
|
||||
return
|
||||
if type(x) is types.InstanceType:
|
||||
if isinstance(x, types.InstanceType):
|
||||
x = x.__class__
|
||||
if hasattr(x, 'im_func'):
|
||||
x = x.im_func
|
||||
|
@ -29,10 +29,10 @@ def dis(x=None):
|
|||
items = x.__dict__.items()
|
||||
items.sort()
|
||||
for name, x1 in items:
|
||||
if type(x1) in (types.MethodType,
|
||||
types.FunctionType,
|
||||
types.CodeType,
|
||||
types.ClassType):
|
||||
if isinstance(x1, (types.MethodType,
|
||||
types.FunctionType,
|
||||
types.CodeType,
|
||||
types.ClassType)):
|
||||
print "Disassembly of %s:" % name
|
||||
try:
|
||||
dis(x1)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue