[Python-Dev] bytes / unicode

P.J. Eby pje at telecommunity.com
Mon Jun 21 18:54:53 CEST 2010


At 01:08 AM 6/22/2010 +0900, Stephen J. Turnbull wrote:
>But if you need that "everywhere", what's so hard about
>
>def urljoin_wrapper (base, subdir):
>     return urljoin(str(base, 'latin-1'), subdir).encode('latin-1')
>
>Now, note how that pattern fails as soon as you want to use
>non-ISO-8859-1 languages for subdir names.

Bear in mind that the use cases I'm talking about here are WSGI 
stacks with components written by multiple authors -- each of whom 
may have to define that function, and still get it right.

Sure, there are some things that could go in wsgiref in the 
stdlib.  However, as of this moment, there's only a very uneasy rough 
consensus in Web-Sig as to how the heck WSGI should actually *work* 
on Python 3, because of issues like these.

That makes it tough to actually say what should happen in the stdlib 
-- e.g., which things should be classed as stdlib bugs, which things 
should be worked around with wrappers or new functions, etc.



More information about the Python-Dev mailing list