diff options
author | Jeremy Hylton <jeremy@alum.mit.edu> | 2009-03-31 13:17:03 (GMT) |
---|---|---|
committer | Jeremy Hylton <jeremy@alum.mit.edu> | 2009-03-31 13:17:03 (GMT) |
commit | 1c157ea984afd94ea3aa9ceeaf14e4de7b0583b4 (patch) | |
tree | 6e4f1b1ea34d6624e234e3eaf02b6e104dabd4d9 /Lib/symtable.py | |
parent | 9d2ee5ded2ffd7e533776936ac3b34dbb782a847 (diff) | |
download | cpython-1c157ea984afd94ea3aa9ceeaf14e4de7b0583b4.zip cpython-1c157ea984afd94ea3aa9ceeaf14e4de7b0583b4.tar.gz cpython-1c157ea984afd94ea3aa9ceeaf14e4de7b0583b4.tar.bz2 |
Add is_declared_global() which distinguishes between implicit and
explicit global variables.
Diffstat (limited to 'Lib/symtable.py')
-rw-r--r-- | Lib/symtable.py | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/Lib/symtable.py b/Lib/symtable.py index a8112ff..44d70a3 100644 --- a/Lib/symtable.py +++ b/Lib/symtable.py @@ -190,6 +190,9 @@ class Symbol(object): def is_global(self): return bool(self.__scope in (GLOBAL_IMPLICIT, GLOBAL_EXPLICIT)) + def is_declared_global(self): + return bool(self.__scope == GLOBAL_EXPLICIT) + def is_local(self): return bool(self.__flags & DEF_BOUND) |