[Python-Dev] Reasons behind misleading TypeError message when passing the wrong number of arguments to a method (original) (raw)
Greg Ewing greg.ewing at canterbury.ac.nz
Fri May 21 03:23:15 CEST 2010
- Previous message: [Python-Dev] Reasons behind misleading TypeError message when passing the wrong number of arguments to a method
- Next message: [Python-Dev] bug or feature? fixing argparse's default help value for version actions
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Floris Bruynooghe wrote:
Not having looked at the code I don't know how hard it is for the code that raises this traceback to notice if it's a bound or unbound method tough.
The way things currently work, it would be quite difficult. The exception is raised when attempting to call the function underlying the bound method, at which point it can't be distinguished from any other way of calling it.
However, it could be made to raise a special subclass of TypeError that the bound method wrapper could catch and replace with its own exception.
-- Greg
- Previous message: [Python-Dev] Reasons behind misleading TypeError message when passing the wrong number of arguments to a method
- Next message: [Python-Dev] bug or feature? fixing argparse's default help value for version actions
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]