[Python-checkins] r72551 - python/trunk/Lib/dis.py

benjamin.peterson python-checkins at python.org
Sun May 10 16:16:48 CEST 2009


Author: benjamin.peterson
Date: Sun May 10 16:16:47 2009
New Revision: 72551

Log:
use isinstance

Modified:
   python/trunk/Lib/dis.py

Modified: python/trunk/Lib/dis.py
==============================================================================
--- python/trunk/Lib/dis.py	(original)
+++ python/trunk/Lib/dis.py	Sun May 10 16:16:47 2009
@@ -19,7 +19,7 @@
     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 @@
         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)


More information about the Python-checkins mailing list