0

In python we can use the following:

symtable.symtable(code,file,compile type)

But is it possible to get a symtable object a current executable code?

Brian Tompsett - 汤莱恩
  • 5,753
  • 72
  • 57
  • 129
St.Antario
  • 26,175
  • 41
  • 130
  • 318

1 Answers1

1

The executable code itself carries that information. See the inspect module documentation, but code objects have co_names and co_varnames, for example.

Martijn Pieters
  • 1,048,767
  • 296
  • 4,058
  • 3,343
  • So if we cannot get access to a symbol table of current executable code directly it isn't clear why does symtable object type is introduced? Is it for checking of the specifiec symbol tables `code`? – St.Antario Mar 02 '14 at 17:13
  • It is there for the parser and compiler to build the bytecode. – Martijn Pieters Mar 02 '14 at 17:33