comparing strings and ints

Fredrik Lundh effbot at telia.com
Wed Apr 12 12:46:58 EDT 2000


Gordon McMillan <gmcm at hypernet.com> wrote:
> Certainly nothing in Doc/lib/built-in-funcs.html mentions any
> danger in comparing arbitrary objects, nor the discussion in
> 2.1.5.2 ( Lib | Built-in Types | Mutable Sequence Types | sort).

otoh, 1.6a2 cannot compare strings safely:

Python 1.6a2 (#0, Apr  5 2000, 23:56:55)
Copyright 1991-1995 Stichting Mathematisch Centrum, Amsterdam
>>> u"abc" < "†„”"
Traceback (most recent call last):
  File "<stdin>", line 1, in ?
ValueError: UTF-8 decoding error: unexpected code byte

</F>





More information about the Python-list mailing list