ANN compiler2 : Produce bytecode from Python 2.5 Abstract Syntax Trees

Paul Boddie paul at
Tue Oct 24 11:35:22 CEST 2006

Martin v. Löwis wrote:
> Georg Brandl schrieb:
> > Perhaps you can bring up a discussion on python-dev about your improvements
> > and how they could be integrated into the standard library...
> Let me second this. The compiler package is largely unmaintained and
> was known to be broken (and perhaps still is). A replacement
> implementation, especially if it comes with a new maintainer, would
> be welcome.

I don't agree entirely with the "broken" assessment. Although I'm not
chasing the latest language constructs, the AST construction part of
the package seems good enough to me, and apparent bugs like duplicate
parameters in function signatures are actually documented shortcomings
of the functionality provided. I certainly don't like the level of code
documentation; from the baroque compiler.visitor, for example:

# XXX should probably rename ASTVisitor to ASTWalker
# XXX can it be made even more generic?

However, a cursory scan of the bugs filed against the compiler module,
trying hard to filter out other compiler-related things, reveals that
most of the complaints are related to code generation, and the
compiler2 module appears to be squarely aimed at this domain.

I find the compiler package useful - at least the bits not related to
code generation - and despite apparent unawareness of its existence in
the community (judging from observed usage of the parser and tokenizer
modules in cases where the compiler module would have been more
appropriate), I'd be unhappy to see it dropped.


More information about the Python-list mailing list