This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

classification
Title: Remove explicit quotes around %r and {!r}
Type: Stage: resolved
Components: Library (Lib) Versions: Python 3.7
process
Status: closed Resolution: fixed
Dependencies: Superseder:
Assigned To: Nosy List: barry, davin, ethan.furman, pitrou, r.david.murray, serhiy.storchaka
Priority: normal Keywords: patch

Created on 2017-11-28 17:17 by serhiy.storchaka, last changed 2022-04-11 14:58 by admin. This issue is now closed.

Pull Requests
URL Status Linked Edit
PR 4582 merged serhiy.storchaka, 2017-11-28 17:18
Messages (5)
msg307146 - (view) Author: Serhiy Storchaka (serhiy.storchaka) * (Python committer) Date: 2017-11-28 17:17
It is common to use quotes around %s. If the formatted argument is a string this will produce a string in qoutes, that look as a string literal in Python and other programming languages or just as a quoted string in English. But if quotes surround %r this looks like error. If the argument is a string this will lead to doubling qoutes. If its repr is in the form <...>, the angular parenthesis serve a role of qoutes, and additional qoutes are not needed.

PR 4582 removes qoutes around %r and {!r} in format strings.
msg307150 - (view) Author: Antoine Pitrou (pitrou) * (Python committer) Date: 2017-11-28 17:28
Ethan, I think you misunderstood Serhiy's proposal.
msg307151 - (view) Author: Ethan Furman (ethan.furman) * (Python committer) Date: 2017-11-28 17:35
Yup, I sure did.  :/

Looks like a good change to me.  Are these the only instances of quotes used with %r?
msg307152 - (view) Author: Serhiy Storchaka (serhiy.storchaka) * (Python committer) Date: 2017-11-28 17:40
Yes, these are the only instances of quotes used with %r or {!r}.
msg307167 - (view) Author: Serhiy Storchaka (serhiy.storchaka) * (Python committer) Date: 2017-11-28 20:54
New changeset a4a3020abc065d40f57069d6c69d02222ddc85d6 by Serhiy Storchaka in branch 'master':
bpo-32157: Removed explicit quotes around %r and {!r}. (#4582)
https://github.com/python/cpython/commit/a4a3020abc065d40f57069d6c69d02222ddc85d6
History
Date User Action Args
2022-04-11 14:58:54adminsetgithub: 76338
2017-11-28 21:23:06serhiy.storchakasetstatus: open -> closed
resolution: fixed
stage: patch review -> resolved
2017-11-28 20:54:44serhiy.storchakasetmessages: + msg307167
2017-11-28 17:40:05serhiy.storchakasetmessages: + msg307152
2017-11-28 17:36:34ethan.furmansetmessages: - msg307149
2017-11-28 17:35:53ethan.furmansetmessages: + msg307151
2017-11-28 17:28:48pitrousetmessages: + msg307150
2017-11-28 17:27:57yselivanovsetnosy: - yselivanov
2017-11-28 17:27:40ethan.furmansetnosy: + ethan.furman
messages: + msg307149
2017-11-28 17:18:13serhiy.storchakasetkeywords: + patch
pull_requests: + pull_request4530
2017-11-28 17:17:54serhiy.storchakacreate