Skip to content

Remove Redundant f-string

Documentation Index

Fetch the complete documentation index at: https://docs.sourcery.ai/llms.txt

Use this file to discover all available pages before exploring further.

Sourcery refactoring id: remove-redundant-fstring

Section titled “Sourcery refactoring id: remove-redundant-fstring”

If an f-string has no replacements turn it into a regular string.

print(f"Why, oh why am I an f-string")
print("Why, oh why am I an f-string")

Is not necessary to use an f-string that has no replacements so let’s keep it simple and just use a constant string.