[Python-3000] PEP 3100 Comments
Guido van Rossum
guido at python.org
Tue May 9 03:33:37 CEST 2006
On 5/8/06, Steven Bethard <steven.bethard at gmail.com> wrote:
> 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
You're kidding yourself. Consider these two:
def s():
raise NotCallable("ha ha, fooled you!")
or more likely any variant of this:
def s():
's'()
--
--Guido van Rossum (home page: http://www.python.org/~guido/)
More information about the Python-3000
mailing list