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

Jan Kaliszewski zuo at chopin.edu.pl
Sat Jun 9 22:07:03 CEST 2012


I think that BindError proposed in PEP 362 could be a built-in TypeError
subclass, raised whenever given arguments do not match a given callable:

1. while using Signature().bind(...) [as proposed in PEP 362],

 and also

2. while using inspect.getcallargs(...)

 and *also*

3. while doing *any* call.


The present behaviour (ad 2. and 3.), i.e. raising TypeError, makes it
hard to differentiate call-argument-related errors from other TypeError

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.


More information about the Python-ideas mailing list