[New-bugs-announce] [issue31236] improve some error messages of min() and max()
Oren Milman
report at bugs.python.org
Fri Aug 18 17:51:19 EDT 2017
New submission from Oren Milman:
currently, we have the following:
>>> min(0, a=1)
TypeError: 'a' is an invalid keyword argument for this function
>>> max(0, a=1)
TypeError: 'a' is an invalid keyword argument for this function
>>> max(0, a=1, b=2, c=3)
TypeError: function takes at most 2 arguments (3 given)
>>> min(0, a=1, b=2, c=3)
TypeError: function takes at most 2 arguments (3 given)
ISTM it would be preferable for min() and max() to have error messages similar
to those of int():
>>> int(0, a=1)
TypeError: 'a' is an invalid keyword argument for int()
>>> int(0, a=1, b=2)
TypeError: int() takes at most 2 arguments (3 given)
we can achieve this by making a small change in Python/bltinmodule.c in
min_max (I would open a PR soon), and by resolving #31229.
----------
components: IO
messages: 300539
nosy: Oren Milman
priority: normal
severity: normal
status: open
title: improve some error messages of min() and max()
type: behavior
versions: Python 3.7
_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue31236>
_______________________________________
More information about the New-bugs-announce
mailing list