[Python-ideas] Exception for parameter errors

2020-03-04 Thread Stephen J. Turnbull
Steven D'Aprano writes: > Proposal: add a new exception, ParameterError, for parameter > errors. For backwards compatibility it would have to be a subclass > of TypeError. To me, that name evokes all kinds of things that linters and mypy do, but the Python interpreter can't or shouldn't. Func

[Python-ideas] Exception for parameter errors

2020-03-03 Thread Steven D'Aprano
At the moment, when you call a function, if there is any mismatch between the function parameters and the supplied arguments, TypeError is raised. For example: # Too few arguments len() # Too many arguments ord('a', 'b') # Invalid keywords min([], func=len) etc. (There