Python needs better error reporting

David LeBlanc whisper at
Sat Jun 29 01:35:40 EDT 2002

Cute anthropomorphism is lots of fun, but doesn't _quite_ obscure the fact
that computers don't really "tell" anybody anything, programmers do. IIRC,
Python throws this "Syntax Error: invalid syntax" in a number of places. In
the place that I used as an example, looking at the language reference, an
appropriate error would be more like:
	Syntax Error: expected "and", "or", "xor" or ":"

This would at least narrow down what should be looked at to resolve the

Vague error reporting doesn't help new user's self confidance or acceptance
of the language.

I really DO have a point!

David LeBlanc
Seattle, WA USA

> -----Original Message-----
> From: python-list-admin at
> [mailto:python-list-admin at]On Behalf Of Tim Peters
> Sent: Friday, June 28, 2002 21:22
> To: Python-List at Python. Org
> Subject: RE: Python needs better error reporting
> >>> "Syntax Error: invalid syntax" isn't very informative, yet it's
> >>> tossed out frequently. HOW is the syntax invalid?  For example:
> >>>  if s == ' '
> >> That is supposed to start a new block so it should be
> >> if s == ' ':
> > That's not the point - I know that.
> Or, IOW, SyntaxError is all the clue you actually needed.  If the parser
> were to tell you what *it* thinks is wrong, it would be along the lines of
> "the only arcs leading out of this state are 23, 167, and 528".
> Then you'd
> really have a point <wink>.
> --

More information about the Python-list mailing list