[Python-porting] lib2to3 and matching of fixers

Vinay Sajip vinay_sajip at yahoo.co.uk
Tue Dec 13 23:56:37 CET 2011


I'm trying to write a custom lib2to3 fixer which, when processing the source

x = b'foo' b'bar'

will match the right hand side of the expression. From what I can see I should
be able to match it with 'atom' or 'power', but it doesn't seem to match either
of those. The individual byte-string tokens are matched using STRING, as
expected.

What should I use to match the right-hand side, for example if I want to do
constant folding and transform to something like b'foobar'?

Regards,

Vinay Sajip



More information about the Python-porting mailing list