Skip to content

Black doesn't format expressions inside f-strings #567

@mxr

Description

@mxr

Operating system: macOS 10.13.6
Python version: 3.7.0
Black version: 18.9b0
Does also happen on master: yes


Given this example

prefix = "foo"
print(f"{ prefix        }.bar")

I was expecting black to trim the whitespace inside the f-string braces, but black leaves the file as-is.

Is this a bug or expected?

Metadata

Metadata

Assignees

No one assigned

    Labels

    C: parserHow we parse code. Or fail to parse it.F: stringsRelated to our handling of stringsT: enhancementNew feature or requestT: styleWhat do we want Blackened code to look like?

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions