[Python-Dev] Re: Python-checkins digest, Vol 1 #370 - 8 msgs

Ka-Ping Yee ping@lfw.org
Mon, 28 Feb 2000 12:46:16 -0600 (CST)


On Mon, 28 Feb 2000, Guido van Rossum wrote:
> 
> This is different.  Maybe the docs are wrong; I always intended for
> both max(a, b, ...) and max(seq) to be valid.

I suppose in this case it's clear what you mean just from the
number of arguments.  But there is a potential surprise if someone
who expects to have to say max(a, b, ...) then writes

    apply(max, tuple)

and tuple turns out to only have one element.  (I don't think
i've ever realized that we could use min() or max() on a sequence.)

> (BTW, perhaps the __contains__ changes should be extended to __max__
> and __min__?  They share many of the same issues.)

Indeed -- but then who do you trust?  The first element of the
sequence?  Is it acceptable for

    max(a, b, c, d)

to read as

    "a, please tell me which is the maximum among yourself, b, c, and d"

?  Does 'a' then have to take care of the type-comparison logic
for consistency with everything else?  What if 'a' happens to be
a built-in type but 'c' is a user-defined instance?


-- ?!ng