[Python-Dev] Re: [I18n-sig] Re: Unicode debate

Ka-Ping Yee ping@lfw.org
Tue, 2 May 2000 22:56:12 -0700 (PDT)


On Wed, 3 May 2000, Tim Peters wrote:
> [Toby]
> > I assume 'fail' means 'non-equal', rather than 'raises an exception'?
> 
> [Guido]
> > Yes, sorry for the ambiguity.
> 
> Huh!  You sure about that?  If we're setting up a case where meaningful
> comparison is impossible, isn't an exception more appropriate?  The current
> 
> >>> 83479278 < "42"
> 1
> 
> probably traps more people than it helps.

Yeah, when i said

    No automatic conversions between Unicode strings and 8-bit "strings".

i was about to say

    Raise an exception on any operation attempting to combine or
    compare Unicode strings and 8-bit "strings".

...and then i thought, oh crap, but everything in Python is supposed
to be comparable.

What happens when you have some lists with arbitrary objects in them
and you want to sort them for printing, or to canonicalize them so
you can compare?  It might be too troublesome for list.sort() to
throw an exception because e.g. strings and ints were incomparable,
or 8-bit "strings" and Unicode strings were incomparable...

So -- what's the philosophy, Guido?  Are we committed to "everything
is comparable" (well, "all built-in types are comparable") or not?


-- ?!ng