Comparison of different types does not throw exception
David Bolen
db3l at fitlinxx.com
Fri Jul 13 15:24:38 EDT 2001
"Gordon Williams" <g_will at cyberus.ca> writes:
> A couple of people have brought up ordering of heterogeneous lists. First,
> I don't know why anyone would want to do this. (Can anyone give me an
> example where they have done this for a "real world" problem?).
I'm not sure if I've done this with a list solely of built-in types,
but I've definitely had lists of various subclassed object types that
implemented __cmp__. In one case it wasn't so much used for sorting
as for comparing objects (that represented tasks) when trying to
decide what action to perform next.
I suppose if any proposed change was such that it continued to work if
the objects involved (even if different) did implement __cmp__ that it
wouldn't affect the sort of stuff I've done. I'm guessing that's what
Guido's comment about "leave it up to the types" was implying.
--
-- David
--
/-----------------------------------------------------------------------\
\ David Bolen \ E-mail: db3l at fitlinxx.com /
| FitLinxx, Inc. \ Phone: (203) 708-5192 |
/ 860 Canal Street, Stamford, CT 06902 \ Fax: (203) 316-5150 \
\-----------------------------------------------------------------------/
More information about the Python-list
mailing list