[Python-ideas] BindError as a built-in TypeError subclass (on the margin of PEP 362 discussion)

Chris Rebert pyideas at rebertia.com
Sun Jun 10 09:32:41 CEST 2012


On Sat, Jun 9, 2012 at 5:52 PM, Steven D'Aprano <steve at pearwood.info> wrote:
> Jan Kaliszewski wrote:
>
>> The present behaviour (ad 2. and 3.), i.e. raising TypeError, makes it
>> hard to differentiate call-argument-related errors from other TypeError
>> occurrences.
>>
>> Raising BindError (or ArgumentError? the actual name is disputable of
>> course), being a TypeError instance, instead -- would made easier
>> implementing test suites, RPC mechanisms etc.
>
> +1
>
> 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.

Cheers,
Chris



More information about the Python-ideas mailing list