
May 11, 2013
5:39 a.m.
Andrew Barnert wrote:
Except that % formatting is supposed to be one of those "we haven't deprecated it, but we will, so stop using it" features, so it seems a little odd to add new syntax to make % formatting easier.
Except that the same problem also occurs with .format() formatting.
"a{}b" "c{}d" .format(1,2) 'a1bc2d'
but
"a{}b" + "c{}d" .format(1,2) 'a{}bc1d'
so you need
("a{}b" + "c{}d") .format(1,2) 'a1bc2d'
Also, doesn't this imply that ... is now an operator in some contexts, but a literal in others?
It would have different meanings in different contexts, yes. But I wouldn't think of it as an operator, more as a token indicating string continuation, in the same way that the backslash indicates line continuation. -- Greg