min(iterable) produces the minimum element of the iterable. min(value, value, ...) produces the minimum of all its arguments; it does not notice iterables among the values. Therefore min(value, min(iterable)) is a useful thing to do, but min(value, iterable) will typically throw a TypeError because int and list[int] (for instance) are not comparable. The same applies to max().
To sum up: The code below is the natural way to take the minimum/maximum of an iterable plus some other values, and it should not trigger any W3301 warnings.
************* Module a
a.py:18:8: W3301: Do not use nested call of 'min'; it's possible to do 'min(lo, hi, elements)' instead (nested-min-max)
a.py:19:8: W3301: Do not use nested call of 'max'; it's possible to do 'max(lo, hi, elements)' instead (nested-min-max)
Expected behavior
Do not issue W3301 when the inner call(s) to min/max pass only one argument.
Bug description
min(iterable)
produces the minimum element of the iterable.min(value, value, ...)
produces the minimum of all its arguments; it does not notice iterables among the values. Thereforemin(value, min(iterable))
is a useful thing to do, butmin(value, iterable)
will typically throw a TypeError becauseint
andlist[int]
(for instance) are not comparable. The same applies tomax()
.To sum up: The code below is the natural way to take the minimum/maximum of an iterable plus some other values, and it should not trigger any W3301 warnings.
Command used
Pylint output
Expected behavior
Do not issue W3301 when the inner call(s) to min/max pass only one argument.
Pylint version