[Python-ideas] 'default' keyword argument for max(), min()

George Sakkis george.sakkis at gmail.com
Thu Apr 16 02:45:02 CEST 2009

On Wed, Apr 15, 2009 at 7:09 PM, Steven D'Aprano <steve at pearwood.info> wrote:
> On Thu, 16 Apr 2009 05:19:05 am George Sakkis wrote:
>> I think it would be counter-intuitive and error-prone if
>> min(iterable, default=0) was different from min(*iterable,
>> default=0), so I'd say no on the first one.
> That's already the case.
>>>> min( iter([1]) )
> 1
>>>> min( *iter([1]) )
> Traceback (most recent call last):
>  File "<stdin>", line 1, in <module>
> TypeError: 'int' object is not iterable

Oh right, posted too fast; the single argument case is already
special, so we might as well make the zero arg case special.


More information about the Python-ideas mailing list