-
-
Notifications
You must be signed in to change notification settings - Fork 31.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
bpo-32157: Remove explicit quotes around %r and {!r}. #4582
bpo-32157: Remove explicit quotes around %r and {!r}. #4582
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good to me.
@@ -1166,7 +1166,7 @@ def _match(self, cre, s): | |||
self.mo = cre.match(s) | |||
if __debug__: | |||
if self.mo is not None and self.debug >= 5: | |||
self._mesg("\tmatched r'%r' => %r" % (cre.pattern, self.mo.groups())) | |||
self._mesg("\tmatched %r => %r" % (cre.pattern, self.mo.groups())) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think what this actually wanted to be was r'%s' % cre.pattern.replace('\\\\', '\\')
, but of course that doesn't work in all cases. It would be nice if we had a codec that produced raw string representation (it would have to fall back to repr for cases that can't be represented as raw strings).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I will think about it.
Thank you all! Initially I was going to backport this change to 3.6 and 2.7, but now I am not sure. |
https://bugs.python.org/issue32157