comparing str's with ints
Kragen Sitaker
kragen at pobox.com
Mon Apr 29 18:06:41 EDT 2002
Frank Tobin <ftobin at neverending.org> writes:
> BUT, *this* does not make sense:
> >>> '5' > 3
> 1
>
> What in the world is supposed to be the semantics of comparing a string
> with an integer? Seems like a type trap...
Thus, heterogeneous collections are sortable. This might be a wart;
once, > couldn't raise exceptions, and now we're stuck with its old
behavior in this case for compatibility. It's kind of nice that
heterogeneous collections are sortable, though.
More information about the Python-list
mailing list