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

Yury Selivanov yselivanov.ml at gmail.com
Sun Jun 10 06:36:36 CEST 2012


On 2012-06-09, at 4:07 PM, Jan Kaliszewski wrote:

Suggestion ==========

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. Rationale ========= 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.

That's how it is currently implemented - BindError(TypeError).

I'll mention this in the PEP.



More information about the Python-ideas mailing list