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

Marcin 'Qrczak' Kowalczyk qrczak at knm.org.pl
Wed Apr 15 22:55:57 CEST 2009

2009/4/15 George Sakkis <george.sakkis at gmail.com>:

> I think it would be counter-intuitive and error-prone if min(iterable,
> default=0) was different from min(*iterable, default=0),

It is definitely different if iterable == [[7]].

Since min(*iterable) will break if iterable has length 1, it should
not be called this way at all. Values should be passed to min as
individual arguments only if their number is statically known, and in
this case there is no reason to use 'default'.

Marcin Kowalczyk
qrczak at knm.org.pl

More information about the Python-ideas mailing list