Skip to content

str-bytes-safe with new Formatted string literals #11806

@beauxq

Description

@beauxq

with this code:

f"{b'def'}"

I get this from mypy:

On Python 3 '{}'.format(b'abc') produces "b'abc'", not 'abc'; use '{!r}'.format(b'abc') if this is desired behavior [str-bytes-safe]

That message doesn't make it clear whether there's any issue with my code, because it's about a different string formatting.
And if it is an issue, it doesn't tell me what formatted string literal to use if this is desired behavior.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions