pgen2 use questions.

Brian L. Troutwine goofyheadedpunk at
Wed Jan 10 05:47:20 CET 2007

I happened to stumble upon Guido's announcement of his python2 to
python3 refactoring tool earlier today
and, after playing with it a bit, I have some use questions as I don't
quite understand how the pattern matching language works.

In some instances I cannot grok matching certain sorts of patterns,
sometimes very simple ones. For instance, how is the following
incorrect for matching pass statements?

    pass_stmt< 'pass'>

If I wanted to insert "# Do nothing, and well." after each pass
statement how would the transformation work?

Why would this pattern not match function statements?

               decorators < decs=any >
               atom < def_name=NAME >
               parameters < pars=any >
               suite < suite_content=any >

If I wanted to change the function name how would I do so? How about
parts of the function body?

More information about the Python-list mailing list