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

Replace .format() with f-strings #166

Open
ben05allen opened this issue Jul 13, 2024 · 2 comments
Open

Replace .format() with f-strings #166

ben05allen opened this issue Jul 13, 2024 · 2 comments
Assignees
Labels

Comments

@ben05allen
Copy link
Collaborator

This issue aims to improve the readability and performance of the codebase by replacing .format() method calls with f-strings.

Python 3.6 introduced f-strings (formatted string literals), which provide a more concise and readable way to format strings compared to the .format() method. F-strings are also generally faster.

Identify all instances of .format() in the codebase and refactor them to use f-strings.

Notably, the LineWriter class in write.py uses .format() as the base of its template.

As the oldest Python version supported is 3.8, there is no need to retain .format().

@roskakori roskakori added this to the EuroPython 2024 Sprint milestone Jul 13, 2024
@e-io
Copy link
Collaborator

e-io commented Jul 13, 2024

There are only five ".format" calls total in the project:

Screenshot 2024-07-13 at 15 22 58

So, it would not be difficult to replace them with modern f-strings.

@ben05allen ben05allen self-assigned this Jul 13, 2024
@roskakori roskakori moved this from 🆕 New to 🔖 Ready in Open source projects Jul 13, 2024
@roskakori
Copy link
Owner

Looks good, feel free to assign and implement this any time.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
Status: 🔖 Ready
Development

No branches or pull requests

3 participants