[Python-3000] u'text' as an alias for 'text'?
thomas at python.org
Thu Mar 20 17:50:26 CET 2008
On Thu, Mar 20, 2008 at 9:28 AM, Lennart Regebro <regebro at gmail.com> wrote:
> On Thu, Mar 20, 2008 at 4:40 PM, Charles Merriam
> <charles.merriam at gmail.com> wrote:
> > The problem is not the gratuitous removal of the leading 'u', but the
> > subtle problems when
> > the code looks nearly identical. The most likely one to cause
> > problems is the new semantics
> > of the keys operations. While I haven't read the 3.0 code, this is
> > what was stated at Guido's
> > last talk.
> No, the problem is the lack of u'' support. I've tried. :)
That may be the case now, and with that particular code. It's still very
fragile to *count* on this being true. Python 3.0 should not and must not
have backward compatibility cruft. It defeats the whole point of 3.0 and
devalues it to the point of uselessness. It's just plain silly to discuss
What can be done is adding a future statement to 2.6 to make '' be identical
to u'': 'from __future__ import unicode_strings' or such, but it doesn't
remove the need to use 2to3. Really, use 2to3.
> The new semantics of the keys operation means that keys() will work
> like iterkeys() works now. This is not a problem unless you try to use
> the result of keys() as a list, which isn't commonly done. Those types
> of problems is however completely unavoidable in any case, 2to3 won't
> solve them either, as I understand it.
It'll do a much better job than try-and-pray. It may not matter in any of
your code, but I really suggest not relying on it. Use 2to3.
Thomas Wouters <thomas at python.org>
Hi! I'm a .signature virus! copy me into your .signature file to help me
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the Python-3000