Pep 3101 provides a rationale for ultimately replacing the %
operator with the format
method. This question and the accepted answer dwell on the same points.
I could not find, however, a rationale for the new syntax and I don't understand the benefits of the change. The pep 3101 lists various alternate syntaxes which also included the famous printf
style of format specifiers as noted in the C99 standard and it's variants. (For a documentation example go here to section 7.19.6.1 "The fprintf function" on pages 274ff).
For the new string.format()
method it was considered to reuse the same format specification language that has been in use by the %
operator.
What can be done with the new syntax that could not have been done with the old?
Edit: Parameter reordering could also have been added to the old syntax in the same way it has been added to the ANSI C standard. See any recent man sprintf