This is what evolution looks like.
“We need string concatenation”.
Sure. "hello" + ''' ''' + 'world'
or, if you like, ' '.join(['hello', 'world'])
“But
"found " + str(var) + " matches"
is kind of clumsy. I hear Lisp hasprinc
…?”
Oh okay, here: 'found %i matches' % var
(… Time passes… )
“I hear you are overhauling the entire language and making
Hm, you’re right, okay, here. 'found {0} matches'.format(var)
and yeah, let’s get rid of that unintuitive complexity. We don’t want modulo to be a special case, it’s inelegant.
“Thanks. But… wait, there’s really a lot of code which uses the old syntax, and when you compare them, the new syntax is really clunky.”
Argh. We can make it less clumsy. Have some syntactic sugar! f'found {var} matches'
and there’s more where that came from!
“Mmmm, I dunno. The modulo is still easier to type.”
You’re driving me nuts. Okay, you can play with it if you like. But don’t say I didn’t warn you.
solved Why are there so many formatting flavours in Python?