Kaydet (Commit) e1577fb2 authored tarafından Benjamin Peterson's avatar Benjamin Peterson

use isinstance

üst e3f68a1a
......@@ -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,
if isinstance(x1, (types.MethodType,
types.FunctionType,
types.CodeType,
types.ClassType):
types.ClassType)):
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