3 ms·
It's not obvious which .format() is evaluated first, though. For 'in-line' string interpolation I think the f'' syntax wins. .format() is still nice for templat
by hyperbovine 10y ago
It's not obvious which .format() is evaluated first, though. For 'in-line' string interpolation I think the f'' syntax wins. .format() is still nice for template-style interpolation though. For this reason, and to avoid situations like the parent, I think it should be made static, so that you could write:
>>> formatted = str.format(template, var1='a', var2=3)
Of course, this will never happen due to the need to maintain backward compatibility.
- mixmastamyk 10y agoIn python, function calls start from left and continue to the right. Though f'' doesn't look like a function call, in practice it is.