A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://mail.python.org/pipermail/python-dev/2000-April/003096.html below:

[Python-Dev] Re: Unicode and comparisons

[Python-Dev] Re: Unicode and comparisonsMartin v. Loewis martin@loewis.home.cs.tu-berlin.de
Tue, 4 Apr 2000 17:44:17 +0200
> Question: is this behaviour acceptable or should I go even further
> and mask decoding errors during compares and contains tests too ?

I always thought it is a core property of cmp that it works between
all objects. Because of that,

>>> x=[u'1','aäöü']     
>>> x.sort()
Traceback (most recent call last):
  File "<stdin>", line 1, in ?
UnicodeError: UTF-8 decoding error: invalid data

fails. As always in cmp, I'd expect to get a consistent outcome here
(ie. cmp should give a total order on objects).

OTOH, I'm not so sure why cmp between plain and unicode strings needs
to perform UTF-8 conversion? IOW, why is it desirable that

>>> 'a' == u'a'
1

Anyway, I'm not objecting to that outcome - I only think that, to get
cmp consistent, it may be necessary to drop this result. If it is not
necessary, the better.

Regards,
Martin



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