[Python-Dev] Dicts are broken Was: unicode hell/mixing str and unicode asdictionarykeys
M.-A. Lemburg
mal at egenix.com
Thu Aug 10 11:10:42 CEST 2006
Martin v. Löwis wrote:
> M.-A. Lemburg schrieb:
>> Note that we are not discussing changing the behavior of the
>> __eq__ comparison between strings and Unicode, since this has
>> always been to raise exceptions in case the automatic propagation
>> fails.
>
> Not sure what you are discussing: This is *precisely* what I'm
> discussing. Making that change would solve this problem.
... and introduce a whole set of new problems, namely finding
all the places in your code that are not Unicode compatible.
Instead of reverting the patch and continue to silencing exceptions
in the dict lookup, you are proposing to extend the behavior to all
equal comparisons of strings and Unicode. That would be a major
change in the semantics, not just a bug fix as you seem to imply.
Since the problem of mixing strings and Unicode will go away
in Py3k anyway, I suggest we do everything to help programmers
make their applications Unicode compatible instead of trying
to hide all problem cases from them.
Note that all of these problem go away if you stick to Unicode
for all text data in your application. This will also make
porting the application to Py3k a lot easier.
>
>> The discussion is about silencing exceptions in the dict lookup
>> mechanism - something which used to happen and now no longer
>> is done.
Regards,
--
Marc-Andre Lemburg
eGenix.com
Professional Python Services directly from the Source (#1, Aug 10 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