<div class="gmail_quote">On Fri, Dec 9, 2011 at 10:11 AM, Barry Warsaw <span dir="ltr">&lt;<a href="mailto:barry@python.org">barry@python.org</a>&gt;</span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">
<div class="im">As Chris points out, this seems to be a use case tied to WSGI and PEP 3333.  I</div>
guess it&#39;s an unfortunate choice for so recent a PEP, but maybe there was no<br>
way to do better.  </blockquote><div><br></div><div>For the record, &quot;native strings&quot; are defined the way they are because of IronPython and Jython, which had unicode strings long before CPython.  At the time WSGI was developed, the approach for Python 3 (then called &quot;3000&quot;) was expected to be similar, and the new I/O system was not (AFAIR) designed yet.</div>
<div><br></div><div>All that changed in PEP 3333 was introducing *byte* strings (to accommodate the I/O changes), not native strings.</div><div><br></div><div>In fact, I&#39;m not sure why people are bringing it into this discussion at all: PEP 3333 was designed to work well with 2to3, which does the right thing for WSGI code: it converts 2.x &quot;str&quot; to 3.x &quot;str&quot;, as it should.  If you&#39;re writing 2.x WSGI code with &#39;u&#39; literals, *your code is broken*.</div>
<div><br></div><div>WSGI doesn&#39;t need &#39;u&#39; literals and never has.  It *does* need b&#39;&#39; literals for stuff that refers to request and response bodies, but everything else should be plain old string literals for the appropriate Python version.</div>
<div><br></div><div><br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;"><div class="im">It can certainly be useful in many contexts outside of WSGI.</div></blockquote>
<div><br></div><div>And *only* there, pretty much.  ;-)  PEP 3333 was designed to work with the official upgrade path (2to3), which is why it has a concept of native strings.  Thing is, if you mark them with a &#39;u&#39;, you&#39;re writing incorrect code for  2.x.</div>
<div> </div></div>