Obsolesence of <> (fwd)
Christian Tanzer
tanzer at swing.co.at
Fri Jun 1 02:49:29 EDT 2001
mertz at gnosis.cx wrote:
> Lulu of the Lotus-Eaters <mertz at gnosis.cx> wrote:
> >I'm not really sure I like the change Alex points to. It makes
> >something like the below fail:
> >
> > l = [(1+1j),(2-2j),Klass(),Klass(),Klass,5,4,3,'c','b','a']
> > l.sort()
> >
> >Many of the comparisons have no particular meaning. But it is nice to have
> >everything have some arbitrary inequality relation in order to create
> >partial orderings on the subsets of things that really do have an order.
>
> aahz at panix.com (Aahz Maruch) wrote:
> |Yup, this used to work. Then came Unicode....
>
> Huh? What does Unicode have to do with anything? The below works fine,
> for example:
>
> Python 2.0.42-S1.2.23 (#0, Apr 25 2001, 20:59:49) [GNU C/C++] on os2
> Type "copyright", "credits" or "license" for more information.
> >>> x = u"spam"
> >>> y = "spam"
> >>> z = 1+1j
> >>> w = u"eggs"
> >>> x < y
> 0
> >>> x < z
> 0
> >>> x < w
> 0
>
> At least in my 2.0 version, unicode strings seem to compare fine to
> other things (I didn't try *every* other thing... but the obvious few
> are happy).
Just try:
>>> "öäb" == u"abc"
Traceback (most recent call last):
File "<stdin>", line 1, in ?
UnicodeError: ASCII decoding error: ordinal not in range(128)
:(
Being able to sort lists no matter what elements they contained was
very handy for some purposes...
--
Christian Tanzer tanzer at swing.co.at
Glasauergasse 32 Tel: +43 1 876 62 36
A-1130 Vienna, Austria Fax: +43 1 877 66 92
More information about the Python-list
mailing list