max(s) does not what I expect it to do.

Gerrit Holl gerrit.holl at pobox.com
Sun Jun 20 21:27:09 CEST 1999


On Sun, Jun 20, 1999 at 08:21:21PM +0200, Gerrit Holl wrote:
> Date: 	Sun, 20 Jun 1999 20:21:21 +0200
> From: Gerrit Holl <gerrit.holl at pobox.com>
> To: python-list at python.org
> Subject: max(s) does not what I expect it to do.
> 
> So I did the following:
> 
> Python 1.5.2 (#1, Apr 18 1999, 00:16:12)  [GCC 2.7.2.3] on linux2
> Copyright 1991-1995 Stichting Mathematisch Centrum, Amsterdam
> >>> list = [ ['a'], ['a', 'b'], ['a', 'b', 'c'] ]
> >>> max(list)
> ['a', 'b', 'c']
> >>> list = [ ['a', 'b', 'c'], ['a', 'b'], ['a'] ]
> >>> print max(list)
> ['a', 'b', 'c']
> 

Huh?
This is right!

But if I run this script:

#!/usr/bin/python

list = [ ['a', 'b', 'c'], ['d', 'e'], ['f'] ]

print max(list)

I get:
['f']

groeten,
Gerrit.

-- 
The Dutch Linuxgames homepage:	http://linuxgames.nl.linux.org
Personal homepage:		http://www.nl.linux.org/~gerrit/

Discoverb is a python program in Dutch and English which tests the words you
learned by asking it. Homepage: http://www.nl.linux.org/~gerrit/discoverb/




More information about the Python-list mailing list