[Python-checkins] r79771 - python/branches/py3k/Lib/dis.py

benjamin.peterson python-checkins at python.org
Mon Apr 5 01:26:50 CEST 2010


Author: benjamin.peterson
Date: Mon Apr  5 01:26:50 2010
New Revision: 79771

Log:
factor out constant

Modified:
   python/branches/py3k/Lib/dis.py

Modified: python/branches/py3k/Lib/dis.py
==============================================================================
--- python/branches/py3k/Lib/dis.py	(original)
+++ python/branches/py3k/Lib/dis.py	Mon Apr  5 01:26:50 2010
@@ -10,6 +10,8 @@
            "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 @@
     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)


More information about the Python-checkins mailing list