Funny Python error messages

Carl Banks invalidemail at
Fri Jan 21 12:57:24 EST 2005

Peter Hansen wrote:
> Will Stuyvesant wrote:
> > Perhaps this will even be a useful thread, to brighten the
> > life of the brave people doing the hard work of providing us
> > with error messages.
> >
> > My first one (i'm learning, i'm learning) is
> >
> > TypeError: 'callable-iterator' object is not callable
> >
> > # >>> it = iter(lambda:0, 0)
> > # >>> it()
> > # TypeError: 'callable-iterator' object is not callable
> Given that the supposed humour depends on the *name* of
> the object, which is "callable-iterator", I'd say it's
> probably not hard to come up with lots of "funny" error
> messages this way.

The mildly amusing nature of this error message is due to Will's
finding a name, "callable-iterator" (where callable is a name, not a
description), appearing in a different context from where it was coined
that causes us to parse it differently (where callable is a
description, not a name), and accidentally stating an absurdity.
I'd say it's actually a nice bit of subtlety.


More information about the Python-list mailing list