[Python-3000] String comparison

Guido van Rossum guido at python.org
Wed Jun 6 18:46:13 CEST 2007


On 6/6/07, Stephen J. Turnbull <turnbull at sk.tsukuba.ac.jp> wrote:
> Rauli Ruohonen writes:
>
>  > Strings are internal to Python. This is a whole separate issue from
>  > normalization of source code or its parts (such as identifiers).
>
> Agreed.  But please note that we're not talking about representation.
> We're talking about the result of evaluating a comparison:
>
>     if u"L\u00F6wis" == u"Lo\u0308wis":
>         print "Python is Unicode conforming in this respect."
>     else:
>         print "I guess it's time to start learning Ruby."
>
> I think it's reasonable to be astonished if Python doesn't at least
> try to print "Python is Unicode conforming in this respect." for the
> above snippet by default.

Alas, you will remain astonished for a long time, and you're welcome
to try Ruby instead. I'm all for adding a way to do normalized string
comparisons to the library. But I'm not about to change the ==
operator to apply normalization first. It would affect too much (e.g.
hashing).

-- 
--Guido van Rossum (home page: http://www.python.org/~guido/)


More information about the Python-3000 mailing list