Proposal: min(None, x) and max(None, x) return x

Erik Max Francis max at alcyone.com
Sat Nov 23 17:49:48 EST 2002


Bengt Richter wrote:

> How about adding optional keyword args to min and max, so the
> semantics
> would be something like (not very tested ;-):

That seems like a reasonable extension, but then is it really necessary?
Just preprocess the sequence before you send it to min/max; e.g. to
exclude None from the check:

	max(filter(lambda x: x is not None, L))

or

	max([x for x in L if L is not None])

-- 
 Erik Max Francis / max at alcyone.com / http://www.alcyone.com/max/
 __ San Jose, CA, USA / 37 20 N 121 53 W / &tSftDotIotE
/  \ Said it? yep / Regret it? nope
\__/ Ice Cube
    EmPy / http://www.alcyone.com/pyos/empy/
 A system for embedding arbitrary Python in template text as markup.



More information about the Python-list mailing list