]> granicus.if.org Git - python/commitdiff
simplify this expression
authorBenjamin Peterson <benjamin@python.org>
Sun, 28 Jun 2009 19:30:36 +0000 (19:30 +0000)
committerBenjamin Peterson <benjamin@python.org>
Sun, 28 Jun 2009 19:30:36 +0000 (19:30 +0000)
Lib/symtable.py

index 7277f5e5c358a4443bbd8805f12f9f3d7abf3254..39c1a8014fca8f0a1e9ae44e2604bb8f3ce2d98a 100644 (file)
@@ -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 @@ class Function(SymbolTable):
 
     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