I just learned you can write
'{}{}'.format(string_a, string_b)
instead of
'{0}{1}'.format(string_a, string_b)
in Python, i.e. you can omit the numerals for the string format parameters when you want things to slot in one by one in order.
Is this considered Pythonic?
NOTE: "Pythonic" is a commonly used term among Python programmers to mean idiomatic Python code. Within Python culture, there tends to be clear consensus on style questions, especially for very specific ones like this one, given the language's explicit design philosophy of "There should be one -- and preferably only one -- obvious way to do it." This is quoted from "The Zen of Python," a set of aphorisms which goes a long way towards defining what is "Pythonic" and which is included with every distribution of Python (at any Python interpreter command line, enter import this
to see it).
{}
feature was introduced in Python 3.1. The enhancement that prompted this addition was issue 5237. Guido has several comments on that issue, including "Please go ahead and finish this. I'm glad this is going in!" If that's not considered "Pythonic", I don't know what is."{a}{b}".format(a=string_a, b=string_b)
rather than the numbering. Anyhow, that's just my speculation and reading between the lines on the thinking...