noob question: "TypeError" wrong number of args

Edward Elliott nobody at 127.0.0.1
Wed May 3 19:26:08 EDT 2006


Ben Finney wrote:
> As I understand it, the point was not what the code does, but to give
> a sample input (a Python program) for the "simple text processor" you
> described to wade through.

Ah, well then, there's no need for a full-blown parser.  It should suffice
to recognize a class definition and modify the parameter list of every def
indented one level further than that.  Then pick out the static methods and
'undo' those.  Can be done in one pass by keeping the class definition in
memory until you've scanned the whole thing, then adding self where needed
as you spit it back out.

Implementation is left as an exercise for the reader. :)




More information about the Python-list mailing list