On Mon, 2006-05-08 at 09:47 -0600, Steven Bethard wrote: > On 5/8/06, Barry Warsaw <[EMAIL PROTECTED]> wrote: > > Perhaps then, if we get rid of callable()/PyCallable_Check() it would be > > useful to add a NotCallableError (as a subclass of TypeError?) that > > would get thrown should you try to call something that's not callable. > > The argument to the exception would be the thing you tried to > > erroneously called. > > +1. It'd certainly be nice to be able to tell the difference between > the following two TypeErrors: > > >>> def s(): > ... raise TypeError() > ... > >>> 's'() > Traceback (most recent call last): > File "<interactive input>", line 1, in ? > TypeError: 'str' object is not callable > >>> s() > Traceback (most recent call last): > File "<interactive input>", line 1, in ? > File "<interactive input>", line 2, in s > TypeError
BTW, this is something we could add for Python 2.x if we wanted to. Since NotCallableError would be a subclass of TypeError, all existing code should continue to work. -Barry
signature.asc
Description: This is a digitally signed message part
_______________________________________________ Python-3000 mailing list Python-3000@python.org http://mail.python.org/mailman/listinfo/python-3000 Unsubscribe: http://mail.python.org/mailman/options/python-3000/archive%40mail-archive.com