[issue18111] Add a default argument to min & max
David Beazley
report at bugs.python.org
Tue Jun 4 13:43:57 CEST 2013
David Beazley added the comment:
To me, the fact that m = max(s) if s else default doesn't work with iterators alone makes this worthy of consideration.
I would also note that min/max are the only reduction functions that don't have the ability to work with a possibly empty sequence. For example:
>>> sum([])
0
>>> any([])
False
>>> all([])
True
>>> functools.reduce(lambda x,y: x+y, [], 0)
0
>>> math.fsum([])
0.0
>>>
----------
_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue18111>
_______________________________________
More information about the Python-bugs-list
mailing list