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 <rep...@bugs.python.org>
<http://bugs.python.org/issue31236>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to