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 A few places that look like they'd need to be changed: Modules/_tkinter.c: PyErr_SetString(PyExc_TypeError, "command not callable"); Objects/abstract.c: PyErr_Format(PyExc_TypeError, "'%s' object is not callable", Objects/funcobject.c: PyErr_Format(PyExc_TypeError, "'%s' object is not callable", STeVe -- Grammar am for people who can't think for myself. --- Bucky Katt, Get Fuzzy _______________________________________________ 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