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

Support wrapping within triply-quoted f-strings #22

Open
PeterJCLaw opened this issue Sep 17, 2023 · 0 comments
Open

Support wrapping within triply-quoted f-strings #22

PeterJCLaw opened this issue Sep 17, 2023 · 0 comments

Comments

@PeterJCLaw
Copy link
Owner

PeterJCLaw commented Sep 17, 2023

From what I can tell, it's not valid to have line breaks within a singly quoted f-string (i.e: f"foo {bar}") even if the line breaks appear within a substitution block. Triply quoted (i.e: traditional multi-line strings) do seem to support line breaks in substitution blocks:

f"""
  foo
  {bar(
    3,
  )}
"""

Following form this it might be nice if tuck supported wrapping in these cases. Maybe.

This would need to be a Python 3.12+ only feature though, since only 3.12+ offers useful tokens within f-strings. At that point we'll also need to rework some of our token parsing code given that we currently rely on token.string as a shorthand, however that's not always reliable (see e.g: PeterJCLaw/flake8-commas@8ee37e0).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant