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

simplify this expression

üst a56d036d
...@@ -3,7 +3,7 @@ ...@@ -3,7 +3,7 @@
import _symtable import _symtable
from _symtable import (USE, DEF_GLOBAL, DEF_LOCAL, DEF_PARAM, from _symtable import (USE, DEF_GLOBAL, DEF_LOCAL, DEF_PARAM,
DEF_IMPORT, DEF_BOUND, OPT_IMPORT_STAR, SCOPE_OFF, SCOPE_MASK, FREE, 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 import weakref
...@@ -137,8 +137,8 @@ class Function(SymbolTable): ...@@ -137,8 +137,8 @@ class Function(SymbolTable):
def get_locals(self): def get_locals(self):
if self.__locals is None: if self.__locals is None:
test = lambda x: (((x >> SCOPE_OFF) & SCOPE_MASK) == LOCAL or locs = (LOCAL, CELL)
(x & DEF_BOUND and not x & DEF_GLOBAL)) test = lambda x: ((x >> SCOPE_OFF) & SCOPE_MASK) in locs
self.__locals = self.__idents_matching(test) self.__locals = self.__idents_matching(test)
return self.__locals return self.__locals
......
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