Closed DimitriPapadopoulos closed 11 months ago
Have you changed them one by one and checked they all make sense? Or did you use a script to find and replace them? (in some rare cases like
%02d
,%.2f
or%-10s
, f-string cannot be used as is)
There are not such cases as far as I can see. Yet, it possible to write f{variable!02d}
f{variable:02d}
or f{variable!.2f}
f{variable:.2f}
, isn't it?
There are not such cases as far as I can see. Yet, it possible to write
f{variable!02d}
orf{variable!.2f}
, isn't it?
Sure it is! I just wanted to make sure you (or your custom script?) looked for them, if any :)
I still see a few %s
and %d
in some files (namely yamllint/linter.py
, yamllint/rules/line_length.py
, yamllint/rules/indentation.py
and yamllint/rules/octal_values.py
). Could you check them?
As for the tool I use, it's pyupgrade. But I often end up applying changes manually, because:
pyupgrade
to a single class of changes. I prefer an individual commit per class of changes.%
string interpolation.I have left an instance of %
string interpolation in yamllint/rules/line_length.py
because I find the f-string interpolation is less readable – unless of course I use additional variables to store the result of complex expressions.
They're faster.