Skip to content
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

Remove explicit quotes around %r and {!r} #76338

Closed
serhiy-storchaka opened this issue Nov 28, 2017 · 5 comments
Closed

Remove explicit quotes around %r and {!r} #76338

serhiy-storchaka opened this issue Nov 28, 2017 · 5 comments
Labels
3.7 (EOL) end of life stdlib Python modules in the Lib dir

Comments

@serhiy-storchaka
Copy link
Member

BPO 32157
Nosy @warsaw, @pitrou, @bitdancer, @ethanfurman, @serhiy-storchaka, @applio
PRs
  • bpo-32157: Remove explicit quotes around %r and {!r}. #4582
  • Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.

    Show more details

    GitHub fields:

    assignee = None
    closed_at = <Date 2017-11-28.21:23:06.094>
    created_at = <Date 2017-11-28.17:17:54.294>
    labels = ['3.7', 'library']
    title = 'Remove explicit quotes around %r and {!r}'
    updated_at = <Date 2017-11-28.21:23:06.094>
    user = 'https://github.com/serhiy-storchaka'

    bugs.python.org fields:

    activity = <Date 2017-11-28.21:23:06.094>
    actor = 'serhiy.storchaka'
    assignee = 'none'
    closed = True
    closed_date = <Date 2017-11-28.21:23:06.094>
    closer = 'serhiy.storchaka'
    components = ['Library (Lib)']
    creation = <Date 2017-11-28.17:17:54.294>
    creator = 'serhiy.storchaka'
    dependencies = []
    files = []
    hgrepos = []
    issue_num = 32157
    keywords = ['patch']
    message_count = 5.0
    messages = ['307146', '307150', '307151', '307152', '307167']
    nosy_count = 6.0
    nosy_names = ['barry', 'pitrou', 'r.david.murray', 'ethan.furman', 'serhiy.storchaka', 'davin']
    pr_nums = ['4582']
    priority = 'normal'
    resolution = 'fixed'
    stage = 'resolved'
    status = 'closed'
    superseder = None
    type = None
    url = 'https://bugs.python.org/issue32157'
    versions = ['Python 3.7']

    @serhiy-storchaka
    Copy link
    Member Author

    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.

    @serhiy-storchaka serhiy-storchaka added 3.7 (EOL) end of life stdlib Python modules in the Lib dir labels Nov 28, 2017
    @pitrou
    Copy link
    Member

    pitrou commented Nov 28, 2017

    Ethan, I think you misunderstood Serhiy's proposal.

    @ethanfurman
    Copy link
    Member

    Yup, I sure did. :/

    Looks like a good change to me. Are these the only instances of quotes used with %r?

    @serhiy-storchaka
    Copy link
    Member Author

    Yes, these are the only instances of quotes used with %r or {!r}.

    @serhiy-storchaka
    Copy link
    Member Author

    New changeset a4a3020 by Serhiy Storchaka in branch 'master':
    bpo-32157: Removed explicit quotes around %r and {!r}. (bpo-4582)
    a4a3020

    @ezio-melotti ezio-melotti transferred this issue from another repository Apr 10, 2022
    Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
    Labels
    3.7 (EOL) end of life stdlib Python modules in the Lib dir
    Projects
    None yet
    Development

    No branches or pull requests

    3 participants