[Python-Dev] Example for "property" violates "Python is not a one pass compiler"

Greg Ewing greg.ewing at canterbury.ac.nz
Wed Sep 7 04:36:31 CEST 2005

Nick Coghlan wrote:

> It builds the symbol table before actually trying to compile anything. This is 
> what allows it to figure out which load commands to use for which symbols.

Yes, nowadays I expect it makes two passes over the parse
tree for each function, one to build the symbol table and
one to generate the bytecode.

It used to make a single pass over the parse tree and then
post-process the bytecode once it had figured out which
variables were local -- which I suppose you could call
one-and-a-bit passes. :-)

The distinction between one and two passes isn't so
important in a dynamic language like Python anyway, since
most of the interesting things happen at run time.

Greg Ewing, Computer Science Dept, +--------------------------------------+
University of Canterbury,	   | A citizen of NewZealandCorp, a	  |
Christchurch, New Zealand	   | wholly-owned subsidiary of USA Inc.  |
greg.ewing at canterbury.ac.nz	   +--------------------------------------+

More information about the Python-Dev mailing list