[Python-Dev] from future import unicode_strings? (original) (raw)
Guido van Rossum guido at python.org
Thu Feb 16 02:23:56 CET 2006
- Previous message: [Python-Dev] from __future__ import unicode_strings?
- Next message: [Python-Dev] from __future__ import unicode_strings?
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
On 2/15/06, Neil Schemenauer <nas at arctrix.com> wrote:
I'm in the process of summarizing the dicussion on the bytes object and an idea just occured to me. Imagine that I want to write code that deals with strings and I want to be maximally compatible with P3k. It would be nice if I could add:
from future import unicodestrings and have string literals without a 'u' prefix become unicode instances. I'm not sure how tricky the implementation would be but it seems like a useful feature.
Didn't we have a command-line option to do this? I believe it was removed because nobody could see the point. (Or am I hallucinating? After several days of non-stop discussing bytes that must be considered a possibility.)
Of course a per-module switch is much more useful.
An even crazier idea is to have that import change 'str' to be an alias for 'unicode'.
Now that's crazy talk. :-)
It's probably easier to do that by placing a line
str = unicode
at the top of the file. Of course (like a good per-module switch should!) this won't affect code in other modules that you invoke so it's not clear that it always does the right thing. But it's a start.
-- --Guido van Rossum (home page: http://www.python.org/~guido/)
- Previous message: [Python-Dev] from __future__ import unicode_strings?
- Next message: [Python-Dev] from __future__ import unicode_strings?
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]