[Python-ideas] BindError as a built-in TypeError subclass (on the margin of PEP 362 discussion)
steve at pearwood.info
Sun Jun 10 14:00:30 CEST 2012
Chris Rebert wrote:
>> Since this will be an error that beginners see (frequently), I suggest
>> ArgumentError is more friendly than BindError.
> I note that Ruby also has an ArgumentError, which it raises both for
> calls with an incorrect number of arguments and in cases when Python
> would raise ValueError.
Even if I wanted to replace ValueError with ArgumentError (and I don't), we
couldn't due to backward compatibility.
(Although I suppose ArgumentError could inherit from both TypeError and
My concept is that errors due to the wrong argument count, duplicate or
missing keyword arguments, etc. which currently raise TypeError could raise
ArgumentError, a subclass, instead.
That will make distinguishing between "passed the wrong number of arguments"
from "passed the wrong type of argument" easier.
More information about the Python-ideas