Incomparable abominations

Lulu of the Lotus-Eaters mertz at gnosis.cx
Sun Mar 23 03:17:23 CET 2003


"Tim Peters" <tim_one at email.msn.com> wrote previously:
|Python's comparison sometimes resorts to comparing objects' memory
|addresses.  The most notorious case of that is instances of a common
|class

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.

That is to say, I want the following function always to return True:

    def WantTrue(*l):
        m = list(l)
        n = list(l)
        m.sort()
        n.sort()
        return m == n

My desire was fulfilled for Python 1.5.2 and every earlier version, btw
(the only caveat I can think of is if the builtin 'list' was
overridden).  Python 2.0 broke the desideratum for the new Unicode
objects (sometimes)[*].  Python 2.1 broke it worse for complex numbers.

Yours, Lulu...

[*] I'm not positive whether 1.6 has Unicode, actually.  I don't have
that version installed on my current system (only 1.5.1, 1.5.2, 2.0,
2.0-stackless, 2.1, 2.2.0, 2.2.2, 2.3a2, and Jython 2.0 :-)).

--
 mertz@   _/_/_/_/_/_/_/ THIS MESSAGE WAS BROUGHT TO YOU BY:_/_/_/_/ v i
gnosis  _/_/                    Postmodern Enterprises         _/_/  s r
.cx    _/_/  MAKERS OF CHAOS....                              _/_/   i u
      _/_/_/_/_/ LOOK FOR IT IN A NEIGHBORHOOD NEAR YOU_/_/_/_/_/    g s






More information about the Python-list mailing list