Message300539
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. |
|
Date |
User |
Action |
Args |
2017-08-18 21:51:19 | Oren Milman | set | recipients:
+ Oren Milman |
2017-08-18 21:51:19 | Oren Milman | set | messageid: <1503093079.31.0.160974520345.issue31236@psf.upfronthosting.co.za> |
2017-08-18 21:51:19 | Oren Milman | link | issue31236 messages |
2017-08-18 21:51:19 | Oren Milman | create | |
|