[Python-checkins] r73629 - python/branches/py3k/Lib/symtable.py

benjamin.peterson python-checkins at python.org
Sun Jun 28 21:30:36 CEST 2009


Author: benjamin.peterson
Date: Sun Jun 28 21:30:36 2009
New Revision: 73629

Log:
simplify this expression

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

Modified: python/branches/py3k/Lib/symtable.py
==============================================================================
--- python/branches/py3k/Lib/symtable.py	(original)
+++ python/branches/py3k/Lib/symtable.py	Sun Jun 28 21:30:36 2009
@@ -3,7 +3,7 @@
 import _symtable
 from _symtable import (USE, DEF_GLOBAL, DEF_LOCAL, DEF_PARAM,
      DEF_IMPORT, DEF_BOUND, OPT_IMPORT_STAR, SCOPE_OFF, SCOPE_MASK, FREE,
-     LOCAL, GLOBAL_IMPLICIT, GLOBAL_EXPLICIT)
+     LOCAL, GLOBAL_IMPLICIT, GLOBAL_EXPLICIT, CELL)
 
 import weakref
 
@@ -137,8 +137,8 @@
 
     def get_locals(self):
         if self.__locals is None:
-            test = lambda x: (((x >> SCOPE_OFF) & SCOPE_MASK) == LOCAL or
-                              (x & DEF_BOUND and not x & DEF_GLOBAL))
+            locs = (LOCAL, CELL)
+            test = lambda x: ((x >> SCOPE_OFF) & SCOPE_MASK) in locs
             self.__locals = self.__idents_matching(test)
         return self.__locals
 


More information about the Python-checkins mailing list