At 08:08 PM 9/28/2007 -0700, Guido van Rossum wrote:
>Likely, programmers will attempt to look up keys
>that they know are in the dict -- and if they use the wrong type,
>because of the identical hash values, they will get the TypeError as
>soon as they compare it to the first object at the hashed location.

I'm coming into this thread a little bit late, but if we don't want 
strings and bytes to be comparable, shouldn't we just make them 
*unequal*?  I mean, under normal circumstances, == and != are 
available on all objects without causing errors, and the same 
TypeError would occur for things like list.remove().

This seems a lot like Oleg's question on Python-Dev the other day, 
about raising a TypeError from __nonzero__: i.e., changing a 
significant expectation about all "normal" objects.

While it's true that it would be good to know when you've 
unintentionally mixed bytes and strings, surely there could be less 
fatal ways to find this, like perhaps a command-line option that 
causes byte/string comparisons to output a warning?

_______________________________________________
Python-3000 mailing list
Python-3000@python.org
http://mail.python.org/mailman/listinfo/python-3000
Unsubscribe: 
http://mail.python.org/mailman/options/python-3000/archive%40mail-archive.com

Reply via email to