[Python-Dev] RE: [Patches] selfnanny.py: checking for "self" inevery method
Jeremy Hylton
jeremy@cnri.reston.va.us
Sun, 5 Mar 2000 12:46:14 -0500 (EST)
>>>>> "TP" == Tim Peters <tim_one@email.msn.com> writes:
>>> Grabbing the GregS/BillT enhancement is probably the most
>>> practical thing we could build on right now
>> You got some pointers?
TP> Download python2c (http://www.mudlib.org/~rassilon/p2c/) and
TP> grab transformer.py from the zip file. The latter supplies a
TP> very useful post-processing pass over the parse module's output,
TP> squashing it *way* down.
The compiler tools in python/nondist/src/Compiler include Bill &
Greg's transformer code, a class-based AST (each node is a subclass of
the generic node), and a visitor framework for walking the AST.
The APIs and organization are in a bit of flux; Mark Hammond suggested
some reorganization that I've not finished yet. I may finish it up
this evening.
The transformer module does a good job of incuding line numbers, but
I've occasionally run into a node that didn't have a lineno
attribute when I expected it would. I haven't taken the time to
figure out if my expection was unreasonable or if the transformer
should be fixed.
The compiler-sig might be a good place to discuss this further. A
warning framework was one of my original goals for the SIG. I imagine
we could convince Guido to move warnings + compiler tools into the
standard library if they end up being useful.
Jeremy