[Python-Dev] Re: More informative error messages
Alex Martelli
aleaxit at yahoo.com
Tue Oct 7 04:56:34 EDT 2003
More information about the Python-Dev mailing list
Tue Oct 7 04:56:34 EDT 2003
- Previous message: More informative error messages (Re: [Python-Dev] Efficient predicates for the standard library)
- Next message: [Python-Dev] Re: More informative error messages
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
On Tuesday 07 October 2003 02:33 am, Greg Ewing wrote: > Alex Martelli <aleaxit at yahoo.com>: > > Python's error messages are slowly but surely getting better in that, > > instead of just saying that something (e.g.) "must be int" (and > > leaving the coder in the dark about WHAT it was instead) > > While we're on the subject of error messages, I'd like to > point out another one that could be improved. Often one > sees things like > > TypeError: foo() takes exactly 1 argument (2 given) > > In the case where foo() is a method of some class, and there > are various versions of foo() defined in various superclasses, > it's sometimes hard to tell exactly *which* foo it was trying > to call. It would be much more useful if the module and > class names were included in the error message, e.g. > > TypeError: MyStuff.SomeClass.foo() takes exactly 1 argument (2 > given) A perennial beginners' confusion (recently highlighted in a c.l.py thread whose subject claimed that Python can't count;-) is about that "number of arguments given" number: one calls zoop.bleep() and is told bleep "takes exactly 2 arguments (1 given)" when one is sure that one has given no argument at all (and should give exactly 1) -- the implied 'self' causing the beginners' confusion. It seems to me that, if we work on these messages, we may be able to distinguish the bound-method case into TypeError: bound method bleep() of Zoop instance takes exactly 1 argument (0 given) or some such... Alex
- Previous message: More informative error messages (Re: [Python-Dev] Efficient predicates for the standard library)
- Next message: [Python-Dev] Re: More informative error messages
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
More information about the Python-Dev mailing list