A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://mail.python.org/pipermail/python-dev/2002-October/029744.html below:

[Python-Dev] Using defaultdict as globals/locals for eval()

[Python-Dev] Using defaultdict as globals/locals for eval() [Python-Dev] Using defaultdict as globals/locals for eval()Neil Schemenauer nas@python.ca
Fri, 25 Oct 2002 10:01:29 -0700
Martin v. Loewis wrote:
> Geert Jansen <geertj@boskant.nl> writes:
> > Or altenately, is there a way I can find out which variables are
> > used inside a compiled code block so I can initialize non-specified
> > variables? I have a vague memory that the nested scopes feature has
> > to determine at compile time which variables are being used in a
> > code block.
> 
> Sure: you can parse the code, build an AST tuple (or list), and
> traverse that.

You might want to look at the ptl_compile module in Quixote for some
ideas.  The AST from the 'compiler' package is much nicer than the parse
tree from the 'parser' module.

  Neil



RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4