Skip to content

Use f-string and {var_name=} instead of .format and var_name={var_name}#6494

Merged
not522 merged 4 commits intooptuna:masterfrom
buddy0452004:fix/fstring-modernization
Mar 6, 2026
Merged

Use f-string and {var_name=} instead of .format and var_name={var_name}#6494
not522 merged 4 commits intooptuna:masterfrom
buddy0452004:fix/fstring-modernization

Conversation

@buddy0452004
Copy link
Copy Markdown
Contributor

Closes #6305

Replace .format() string formatting with f-strings in optuna/trial/_frozen.py.

Changes:

  • __repr__: replaced "{cls}({kwargs})".format(cls=..., kwargs=...) with f-string
  • _validate: replaced 3 error message .format() calls with f-strings

No behavior change — only string formatting style updated.

Copy link
Copy Markdown
Member

@not522 not522 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!

@not522 not522 added the code-fix Change that does not change the behavior, such as code refactoring. label Mar 6, 2026
@not522 not522 added this to the v4.8.0 milestone Mar 6, 2026
@not522 not522 merged commit 74e7f4f into optuna:master Mar 6, 2026
13 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

code-fix Change that does not change the behavior, such as code refactoring.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Use f-string and {var_name=} instead of .format and var_name={var_name}

2 participants