Problem with literal arguments in the PATTERN string for a python 2to3 fixer

Posted by Zxaos on Stack Overflow See other posts from Stack Overflow or by Zxaos
Published on 2010-04-06T20:59:52Z Indexed on 2010/04/06 21:03 UTC
Read the original article Hit count: 211

Hi folks. I'm writing a fixer for the 2to3 tool in python.

In my pattern string, I have a section where I'd like to match an empty string as an argument, or an empty unicode string. The relevant chunk of my pattern looks like:

(args='""' | args='u""')

My issue is the second option never matches. Even if it's alone, it won't match. However, if I simply say args=any and then output args, I can catch cases where args is exactly equal to the second option.

Is there some weird unicode handling thing going on? Why won't the second literal option ever match?

© Stack Overflow or respective owner

Related posts about python

Related posts about 2to3