
On Thu, Aug 20, 2015 at 11:40 PM, Nick Coghlan <ncoghlan@gmail.com> wrote:
On 21 August 2015 at 12:52, Guido van Rossum <guido@python.org> wrote: <snip> It's the opposite of the "interpolating untrusted strings that may contain aribtrary expressions" problem - what happens when the variables being *substituted* are untrusted? It's easy to say "don't do that", but if doing the right thing incurs all the repetition currently involved in calling str.format, we're going to see a *lot* of people doing the wrong thing. At that point, the JavaScript backticks-with-arbitrary-named-callable solution starts looking very attractive:
myquery = sql`SELECT $column FROM $table;` mycommand = sh`cat $filename` mypage = html`<html><body>$content</body></html>`
At that point, internationalisation could just be:
translated = _`This $value and this $other_value are interpolated after translation lookup`
The problem with such syntax is that Guido already long ago ruled out using backticks for anything in Python 3: """ No more backticks. Backticks (`) will no longer be used as shorthand for repr -- but that doesn't mean they are available for other uses. Even ignoring the backwards compatibility confusion, the character itself causes too many problems (in some fonts, on some keyboards, when typesetting a book, etc). """ -- https://www.python.org/dev/peps/pep-3099/ Regards, Chris -- http://chrisrebert.com