"Carl Banks" <pavlovevide...@gmail.com> wrote in message
news:bf4be9a7-a079-4454-9969-60e9be305...@k14g2000pre.googlegroups.com...
On Dec 6, 4:17 pm, Steven D'Aprano <steve
+comp.lang.pyt...@pearwood.info> wrote:
On Mon, 06 Dec 2010 08:59:12 -0800, TomF wrote:
> I'm aggravated by this behavior in python:
> x = "4"
> print x < 7 # prints False
> I can't imagine why this design decision was made.
You've never needed to deal with an heterogeneous list?
data = ["Fred", "Barney", 2, 1, None]
data.sort()
Not once, ever.
Nevertheless, I agree that in hindsight, the ability to sort such lists
is not as important as the consistency of comparisons.
I think that feeling the need to sort non-homogenous lists is
indictative of bad design.
Using a simple "<" comparison, perhaps. But can't a list be sorted by other
criteria? For example, by comparing the string representations of each
element.
So some sorts will make sense, and others (such as "<" or ">") won't.
--
Bartc
--
http://mail.python.org/mailman/listinfo/python-list