Guido:
publishers often turn 'foo' into `foo'
It gets worse. The opposite of ` isn't ' -- it's ´. Besides, these are apostrophes and not quotes. _Real_ symmetric quotes are " " or « » or " or ' ' or ' or ..., but you can't use any of these with just ASCII. Apple's MPW Shell language played with some of these. Anyway, I agree that real languages use ${} or $WORD and that formatting is best done with ${NAME:format}. Personally, the "${foo}".sub(foo="bar") syntax (using keyword arguments) looks good and works reasonably well for i18n. A possible simplification would be to use the local+global variables if no arguments are given.
def f(x, y): return e"The sum of $x and $y is $(x+y)"
How would that work with i18n? Proposal: The compiler should translate _"foo is ${foo}" to _("foo is ${foo}") and e"foo is ${foo}" to "foo is ${foo}".sub()
That looks OK to me, especially if it can be combined with u and r to create unicode and raw strings.
Exactly.
PEP 292 is an attempt to do this *without* involving the parser:
def f(x, y): return "The sum of $x and $y is $(x+y)".sub()
Downsides are that it invites using non-literals as formats, with all the security aspects, and that its parsing happens at run-time (no big deal IMO).
You can't do it any other way if you want to use i18nalized strings and formats. Note that some sentences cannot be internationalized without rearranging some parameters... -- Matthias Urlichs