[Python-Dev] RE: [Patches] selfnanny.py: checking for "self"
Moshe Zadka <email@example.com>
Sun, 5 Mar 2000 09:08:41 +0200 (IST)
On Sun, 5 Mar 2000, Tim Peters wrote:
> >> [make Nanny a base class]
> [Moshe Zadka]
> > Why?
> Because it's an obvious application for OO design. A common base class
> formalizes the interface and can provide useful utilities for subclasses.
The interface is just one function. You're welcome to have a do-nothing
nanny that people *can* derive from: I see no point in making them derive
from a base class.
> > As a note, selfnanny uses the parser module AST.
> Understood, but selfnanny has a relatively trivial task.
That it does, and it was painful.
> >> [parser doesn't give source lines]
> > The parser module has source lines.
> No, it does not (it only returns terminals, as isolated strings).
Sorry, misunderstanding: it seemed obvious to me you wanted line numbers.
For lines, use the linecache module...
> > You got some pointers?
> Download python2c (http://www.mudlib.org/~rassilon/p2c/) and grab
> transformer.py from the zip file.
I'll have a look.
Moshe Zadka <firstname.lastname@example.org>.