M.-A. Lemburg wrote: > If a string > is not ASCII and thus causes the exception, there's not a lot you > can say, since you don't know the encoding of the string. That's one way of looking at it. Another is that any string containing chars > 127 is not text at all, but binary data, in which case it's not equal to *any* unicode string -- just like bytes objects will not be equal to strings in Py3k. > All you > know is that it's not ASCII. Instead of guessing, Python then raises > an exception to let the programmer decide. There's no disputing that an exception should be raised if the string *must* be interpretable as characters in order to continue. But that's not true here if you allow for the interpretation that they're simply objects of different (duck) type and therefore unequal. -- Greg
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4