Python's simplicity philosophy

Michael Geary Mike at DeleteThis.Geary.com
Fri Nov 21 14:23:19 EST 2003


Curt wrote:
> I'm saying exactly what I said, i.e. that any arbitrary
> list upon which one performs an operation which
> segregates items into groups according to a specified
> criterion is sorted. If you have a list of cows and cats
> and dogs, and perform an operation on said list which
> groups all the cows together, you have sorted that list
> "by cows".  This appears to me to be a standard
> definition; I have yet to see an argument from you
> that would dissuade me from believing this to be
> true, but I would love to see it if it exists.

Curt, you have a point that in conventional English usage, "sorted" does not
necessarily mean "ordered". For example, if you hand me a bag of mixed fruit
and ask me to sort the fruit, I won't need to ask you what order to put them
in. I will merely separate out the apples, oranges, bananas, pears, and what
have you.

But you must realize that in the software world, when someone says "sorted"
they usually do mean "sorted and ordered". That's why people have been
having trouble understanding your point.

Even so, you are quite mistaken about the uniq command. It really has
nothing to do with the input being sorted at all. Consider this file:

up
down
up
up
down
down
down
up
up
up
down
down

This file is not sorted by any definition of the word. Agreed? Now run uniq
on it and you'll get this result:

up
down
up
down
up
down

As you can see, uniq simply removes consecutive duplicate lines, nothing
more and nothing less. It does this whether the file is ordered, sorted, or
unsorted.

-Mike






More information about the Python-list mailing list