[Python-Dev] RE: [Patches] selfnanny.py: checking for "self" in
every method
Moshe Zadka
Moshe Zadka <mzadka@geocities.com>
Sun, 5 Mar 2000 08:16:22 +0200 (IST)
On Sat, 4 Mar 2000, Tim Peters wrote:
> I like Moshe's suggestion fine, except with an abstract base class named
> Nanny with a virtual method named check_ast. Nannies should (of course)
> derive from that.
Why? The C++ you're programming damaged your common sense cycles?
> > Since parsing is expensive, we probably want to share the parse tree.
>
> What parse tree? Python's parser module produces an AST not nearly "A
> enough" for reasonably productive nanny writing.
As a note, selfnanny uses the parser module AST.
> GregS & BillT have
> improved on that, but it's not in the std distrib. Other "problems" include
> the lack of original source lines in the trees,
The parser module has source lines.
> and lack of column-number info.
Yes, that sucks.
> Note that by the time Python has produced a parse tree, all evidence of the
> very thing tabnanny is looking for has been removed. That's why she used
> the tokenize module to begin with.
Well, it's one of the few nannies which would be in that position.
> God knows tokenize is too funky to use too when life gets harder (check out
> checkappend.py's tokeneater state machine for a preliminary taste of that).
Why doesn't checkappend.py uses the parser module?
> Grabbing the GregS/BillT enhancement is probably the most
> practical thing we could build on right now
You got some pointers?
> (but tabnanny will have to remain a special case).
tim-will-always-be-a-special-case-in-our-hearts-ly y'rs, Z.
--
Moshe Zadka <mzadka@geocities.com>.
http://www.oreilly.com/news/prescod_0300.html