Forgetting "()" when calling methods

Lulu of the Lotus-Eaters mertz at gnosis.cx
Mon Apr 28 12:11:23 EDT 2003


|Tim Peters wrote:
|> For years, ints came
|> out "less than" lists, which in turn came out "less than" longs, so that
|>     [10, [9], 7L, 8]
|> was considered to be "in sorted order" as-is.  It was something like 7
|> years before someone finally noticed how nuts that was.

Alex Martelli <aleax at aleax.it> wrote previously:
|*Blink* -- I don't get it.  Even if int < list < long, how CAN the
|two int's here be ``considered in sorted order''???

I had foolishly imagined that the Timbot had a slip-of-the-finger (or
whatever organ a robot has) in the example.  But in Python 1.5.1 (and
presumably earlier), the stated example is correct:

    Python 1.5.1 (#0, Sep 21 1998, 08:28:40) [VisualAge C/C++] on os2
    Copyright 1991-1995 Stichting Mathematisch Centrum, Amsterdam
    >>> l = [10, [9], 7L, 8]
    >>> l.sort()
    >>> l
    [10, [9], 7L, 8]

This seems natural once you consider that:

    >>> 7L < 8
    1
    >>> [9] < 7L
    1
    >>> 10 < [9]
    1

:-)

Yours, Lulu...

--
    _/_/_/ THIS MESSAGE WAS BROUGHT TO YOU BY: Postmodern Enterprises _/_/_/
   _/_/    ~~~~~~~~~~~~~~~~~~~~[mertz at gnosis.cx]~~~~~~~~~~~~~~~~~~~~~  _/_/
  _/_/  The opinions expressed here must be those of my employer...   _/_/
 _/_/_/_/_/_/_/_/_/_/ Surely you don't think that *I* believe them!  _/_/






More information about the Python-list mailing list