[Python-Dev] RE: [Patches] selfnanny.py: checking for "self" inevery method
Guido van Rossum
Sun, 05 Mar 2000 07:24:41 -0500
> >> [parser doesn't give source lines]
> > The parser module has source lines.
> No, it does not (it only returns terminals, as isolated strings). The
> tokenize module does deliver original source lines in their entirety (as
> well as terminals, as isolated strings; and column numbers).
Moshe meant line numbers - -it has those.
> > Why doesn't checkappend.py uses the parser module?
> Because it wanted to display the acutal source line containing an offending
> "append" (which, again, the parse module does not supply). Besides, it was
> a trivial variation on tabnanny.py, of which I have approximately 300 copies
> on my disk <wink>.
Of course another argument for making things more OO. (The code used
in tabnanny.py to process files and recursively directories fronm
sys.argv is replicated a thousand times in various scripts of mine --
Tim took it from my now-defunct takpolice.py. This should be in the
std library somehow...)
> >> Grabbing the GregS/BillT enhancement is probably the most
> >> practical thing we could build on right now
> > You got some pointers?
> Download python2c (http://www.mudlib.org/~rassilon/p2c/) and grab
> transformer.py from the zip file. The latter supplies a very useful
> post-processing pass over the parse module's output, squashing it *way*
Those of you who have seen the compiler-sig should know that Jeremy
made an improvement which will find its way into p2c. It's currently
on display in the Python CVS tree in the nondist branch: see
and the ensuing thread for more details.
--Guido van Rossum (home page: http://www.python.org/~guido/)