summaryrefslogtreecommitdiffstats
path: root/Lib
diff options
context:
space:
mode:
authorJeremy Hylton <jeremy@alum.mit.edu>2001-03-23 15:41:14 (GMT)
committerJeremy Hylton <jeremy@alum.mit.edu>2001-03-23 15:41:14 (GMT)
commit101651c128825a05a7ba7c1c556c90e22bfb86c2 (patch)
tree5501fed14a2c06ee95e947d251b1b5b2840e9238 /Lib
parent26fabb00167143aaf7458284ce7201103d9b28ff (diff)
downloadcpython-101651c128825a05a7ba7c1c556c90e22bfb86c2.zip
cpython-101651c128825a05a7ba7c1c556c90e22bfb86c2.tar.gz
cpython-101651c128825a05a7ba7c1c556c90e22bfb86c2.tar.bz2
flesh out __all__
remove debugging code in if __debug__: add get_children() method on SymbolTable
Diffstat (limited to 'Lib')
-rw-r--r--Lib/symtable.py20
1 files changed, 6 insertions, 14 deletions
diff --git a/Lib/symtable.py b/Lib/symtable.py
index 3133633..6401d51 100644
--- a/Lib/symtable.py
+++ b/Lib/symtable.py
@@ -8,7 +8,8 @@ from _symtable import USE, DEF_GLOBAL, DEF_LOCAL, DEF_PARAM, \
import weakref
-__all__ = ["symtable", "SymbolTable", "newSymbolTable"]
+__all__ = ["symtable", "SymbolTable", "newSymbolTable", "Class",
+ "Function", "Symbol"]
def symtable(code, filename, compile_type):
raw = _symtable.symtable(code, filename, compile_type)
@@ -117,6 +118,10 @@ class SymbolTable:
for st in self._table.children
if st.name == name]
+ def get_children(self):
+ return [newSymbolTable(st, self._filename)
+ for st in self._table.children]
+
class Function(SymbolTable):
# Default values for instance variables
@@ -236,19 +241,6 @@ class Symbol:
raise ValueError, "name is bound to multiple namespaces"
return self.__namespaces[0]
-if __debug__:
- class Foo:
- version = 1
-
- class Foo:
- version = 2
-
- class Foo:
- version = 3
-
- def execfunc(x):
- exec x in y
-
if __name__ == "__main__":
import os, sys
src = open(sys.argv[0]).read()