[Python-ideas] BindError as a built-in TypeError subclass (on the margin of PEP 362 discussion) (original) (raw)
Jan Kaliszewski zuo at chopin.edu.pl
Sat Jun 9 22:07:03 CEST 2012
- Previous message: [Python-ideas] Replacing the standard IO streams (was Re: changing sys.stdout encoding)
- Next message: [Python-ideas] BindError as a built-in TypeError subclass (on the margin of PEP 362 discussion)
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
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:
- while using Signature().bind(...) [as proposed in PEP 362],
and also
- while using inspect.getcallargs(...)
and also
- 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.
Cheers. *j
- Previous message: [Python-ideas] Replacing the standard IO streams (was Re: changing sys.stdout encoding)
- Next message: [Python-ideas] BindError as a built-in TypeError subclass (on the margin of PEP 362 discussion)
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]