[Python-Dev] unicode hell/mixing str and unicode as dictionary keys

M.-A. Lemburg mal at egenix.com
Tue Aug 8 17:33:46 CEST 2006


Armin Rigo wrote:
> Hi,
> 
> On Thu, Aug 03, 2006 at 07:53:11PM +0200, M.-A. Lemburg wrote:
>>> I though I'd heard (from Guido here or on the py3k list) that it was only 
>>> 1 < u'abc' that would raise an exception, and that 1 == u'abc' would still 
>>> evaluate to False.  Did I misunderstand?
>> Could be that I'm wrong.
> 
> I also seem to remember that TypeErrors should only signal ordering
> non-sense, not equality.  In this case, I'm on the opinion that unicode
> objects and completely-unrelated strings of random bytes should
> successfully compare as unequal, but I'm not enough of a unicode user to
> be sure.

Agreed - for Py3k where strings no longer exist and Unicode is
the only text type.

In Python 2.x the situation is a little different, since strings
are still very often used as container for text data.

-- 
Marc-Andre Lemburg
eGenix.com

Professional Python Services directly from the Source  (#1, Aug 08 2006)
>>> Python/Zope Consulting and Support ...        http://www.egenix.com/
>>> mxODBC.Zope.Database.Adapter ...             http://zope.egenix.com/
>>> mxODBC, mxDateTime, mxTextTools ...        http://python.egenix.com/
________________________________________________________________________

::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,FreeBSD for free ! ::::


More information about the Python-Dev mailing list