David Mertz, Ph.D.
mertz at gnosis.cx
Sun Mar 23 08:52:49 CET 2003
|[Lulu of the Lotus-Eaters]
|> I have no particular desire to have sorting work identically between
|> platforms, versions, or even different interpreter runs. As I wrote
|> before, I just want it consistent *within* an interpreter run.
Tim Peters <tim.one at comcast.net> wrote previously:
|Yes, I saw that before, and it's unclear why you're repeating it. As I
|explained in the post to which you're replying here, inconsistency across
|runs creates real problems for real apps.
You seemed to be answering Mike Meyer's stronger statement that the same
*version* should always sort the same, which I agree is too strong.
Looking at your first note again, I see what you were getting at with
ZODB persistence as being a case where differences between *runs* could
cause problems. The point was not clear (to me) at first read.
|*why* you want sorting "to work" even when comparison results are
|pulled out of thin air. ...Comparing regular strings to Unicode...
|Python wasn't designed on the principle of maximal surprise <0.5 wink>.
But the current list sorting behavior is BY FAR the most surprising
thing in Python! I would have a big challenge explaining it to a new
user... heck, I can hardly remember the border cases myself.
The examples I gave in my first post for this thread show how surprising
the exceptions are. I really think that more than half of highly
experienced Python programmers would have gotten at least one of them
wrong in their intuition (not you, not Alex... maybe not Guido :-)...
but past that, mistakes).
I guess part of what goes into this is different intuitions about the
meaning of sorting. I put sorting a list into a different conceptual
category than comparing individual items (while knowing, of course, the
underlying relatedness of the concepts). Sorting, to me, just means a
stable (but arbitrary) ordering. Comparison with "<" and friends
implie, to me, a "natural" ordering. I wouldn't mind if "<" stopped
comparing anything without an obviously correct answer.
Even then, no matter how you cut it, the relation "1j < 2j" is
self-evident and natural. How can I explain to anyone why that is an
error rather than a True result?!
---[ to our friends at TLAs (spread the word) ]--------------------------
Echelon North Korea Nazi cracking spy smuggle Columbia fissionable Stego
White Water strategic Clinton Delta Force militia TEMPEST Libya Mossad
---[ Postmodern Enterprises <mertz at gnosis.cx> ]--------------------------
More information about the Python-list