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

Michael Hudson mwh at python.net
Fri Aug 4 12:06:11 CEST 2006


"M.-A. Lemburg" <mal at egenix.com> writes:

> The point here is that a typical user won't expect any comparisons
> to be made when dealing with dictionaries, simply because the fact
> that you do need to make comparisons is an implementation detail.

Of course looking things up in a dictionary involves comparisons!  How
could it not?

> So in this particular case silencing the exception might be the
> more user friendly way of dealing with the problem.

Please, no.

> That said, the problem still lingers in that dictionary, so it may
> bite you in some other context, e.g. when iterating over the list
> of keys.

For this reason, and others.

Cheers,
mwh

-- 
  <dash> web in my head get it out get it out
                                                -- from Twisted.Quotes


More information about the Python-Dev mailing list