[issue37996] 2to3 introduces unwanted extra backslashes for unicode characters in regular expressions

Bob Kline report at bugs.python.org
Sat Aug 31 16:39:39 EDT 2019


Bob Kline <bkline at rksystems.com> added the comment:

Thanks, I understand. However, this highlights something which had slipped under my radar. You get one shot at running a code set through the tool. You can't do what I was doing, which was to run the tool in "don't write" mode, then fix by hand some of the things it says will need to be done, then run it again in the same mode, fix, etc., until I got to the point where I felt like I could trust it (except for things like adding unnecessary `list()` wrappers, for which I learned how to use the option for suppressing certain default fixers), and then run the tool in write mode to fix what was left. I now totally get why the tool did what it did, and why the approach I was using was inappropriate, but was there a warning to this effect that I missed in the documentation? Something like "you can only run this tool once per fixer (or set of fixers) in write mode, and you cannot run a fixer on code for which you have performed any of the needed conversions for that fixer yourself"? Of course, it's always possible I'm the only developer clueless enough not to have figured this out without such a warning. :-)

Partly in my (lame) defense, I had lured myself into the frame of mind where what I was doing seemed to make sense by having just come out of a similar exercise with pylint, where iterative "fixing" works just fine. I guess I should take this as a good sign, that my brain has moved so far into the Python 3 world that "..." was no longer recognizable as a bytestring.

Again, thanks for the gentle explanation. :-)

----------

_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue37996>
_______________________________________


More information about the Python-bugs-list mailing list