tensorly
tensorly copied to clipboard
Use f-strings instead of `str.format`
Currently, TensorLy uses the format-method for string formatting. However, in Python 3.6, f-strings were introduced, so the only reason to use the format-method instead of f-strings is for support of Python 3.5, which reached end-of-life in 2020. We can therefore safely replace all calls to str.format with f-strings, which is more readable. See example below:
x = 1.
s1 = "{}".format(x)
s2 = f"{x}"
s3 = "{:.1f}".format(x)
s4 = f"{x:.1f}"
print(s1 == s2)
print(s3 == s4)
True
True
More information is available in this tutorial: https://realpython.com/python-f-strings/
Hello! I volunteer to take care of this issue.
Great, thanks @bakhtos and welcome to the project!
This should be complete!