[Python-Dev] readd u'' literal support in 3.3? (original) (raw)

Chris McDonough chrism at plope.com
Mon Dec 12 09:40:42 CET 2011


On Sat, 2011-12-10 at 15:55 +1000, Nick Coghlan wrote:

So I'm back to being -1 on the idea of adding back u'' literals for 3.3. Instead, people should explicitly call str() on any literals that they want to be actual str instances both in 3.x and in 2.x when the unicode literals future import is in effect.

After thinking on it a while, I can't see anything wrong with this strategy except for the 10X performance hit for defining native literals.

Truth be told, in the vast majority of WSGI apps only high-level WSGI libraries (like WebOb and Werkzeug) and standalone middleware really needs to work with native strings. And the middleware really should be using the high-level libraries to parse WSGI anyway. So there are a finite number of places where it's actually a real issue.

As someone who ported WebOb and other stuff built on top of it to Python 3 without using "from future import unicode_literals", I'm kinda sad that to be using best practice I'll have to go back and flip the polarity on everything. It's my cross to bear, though. If I have any issue with it in the future I'll bring u'' back up.



More information about the Python-Dev mailing list