<div dir="ltr">But how would you determine the current active language? Is that a thread local?<div>This would probably not work to make an asyncio or Twisted applications translatable.</div><div><br></div><div>For an asyncio web application for instance, the translate function needs to know the request object.</div></div><div class="gmail_extra"><br><div class="gmail_quote">2015-08-17 23:37 GMT+02:00 Ned Batchelder <span dir="ltr"><<a href="mailto:ned@nedbatchelder.com" target="_blank">ned@nedbatchelder.com</a>></span>:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><span class=""><br>
On 8/17/15 11:51 AM, Barry Warsaw wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
One of the things I've mentioned to Nick about PEP 501 is the difference<br>
between i"foo" and iu"foo".  The former gets mapped to __interpolate__() while<br>
the latter gets mapped to __interpolateu__().  Nick makes the case for this<br>
distinction based on the ability to override __interpolate__() in the local<br>
namespace to implement i18n, whereas __interpolateu__() - while technically<br>
still able to override - would generally just be left to the "normal" non-i18n<br>
interpolation.<br>
<br>
I countered with a proposal that a context manager could be used, but Nick<br>
points out that you can't really *unbind* __interpolate__() when the context<br>
manager exits.<br>
<br>
This still seems weird to me.  There's no distinction in Python 3 between<br>
"foo" and u"foo" with the latter having been re-added to aid in migrations<br>
between Python 2 and 3.  But with PEP 501, this introduces a functional<br>
distinction between i"foo" and iu"foo" (and ui"foo"?).  It's handy, but seems<br>
to be a fairly significant difference from the current use if u-prefixes.  I'm<br>
sympathetic but still skeptical. ;)<br>
</blockquote>
<br></span>
I agree that this "one weird trick" of distinguishing between i"" and iu"" is really unfortunate. As you say, in Python 3, "foo" and u"foo" are the same, so why should i"" and iu"" be different?<br>
<br>
I understand the appeal of interpolated strings, but can we retain some measure of "explicit is better than implicit"?  If i18n considerations are this important (and I agree that they are), let's take them seriously enough to give them real syntax.<span class="HOEnZb"><font color="#888888"><br>
<br>
--Ned.</font></span><div class="HOEnZb"><div class="h5"><br>
_______________________________________________<br>
Python-ideas mailing list<br>
<a href="mailto:Python-ideas@python.org" target="_blank">Python-ideas@python.org</a><br>
<a href="https://mail.python.org/mailman/listinfo/python-ideas" rel="noreferrer" target="_blank">https://mail.python.org/mailman/listinfo/python-ideas</a><br>
Code of Conduct: <a href="http://python.org/psf/codeofconduct/" rel="noreferrer" target="_blank">http://python.org/psf/codeofconduct/</a><br>
</div></div></blockquote></div><br></div>