[Python-Dev] SyntaxError patches

Thomas Wouters thomas@xs4all.net
Wed, 12 Jul 2000 21:40:03 +0200


On Wed, Jul 12, 2000 at 12:26:51PM -0700, Ka-Ping Yee wrote:
> On Wed, 12 Jul 2000, Jeremy Hylton wrote:
> >       File "<stdin>", line 4
> >         def foo(bar):

> >     SyntaxError: dedent does not match any outer indentation level
> [...]
> > I don't know what a dedent is.  Nor do I know what "outer indentation
> > levels" are or how they might apply to the line "def foo(bar):".

> The intended meaning is "this line is less indented than the previous
> one, but i can't determine what block it goes with because there's
> no surrounding block indented at the same level".  In short form, this
> became: "unindent does not match any outer indentation level".

If the objective is to make error messages more accessible understandable to
newbies, how about:

  Can't figure out where this statement belongs

or

  Can't figure out what block this statement belongs to

or 

  Can't figure out where you wanted to place this line

or

  There seems to be something wrong with the indentation of this line

etc. Or they could be more Monty Python-esque. Anyone use the unix util
'screen', and its 'nethack' mode ? Excellent tool, both ways :-)

Since these are syntax errors, not runtime errors, I'd say it's safe to use
a more accusing stance to the viewer (that is, they're very likely to be the
cause !) and I don't really see why all error messages should be
mathematically correct, and thus phrased in some kind of lawyerese ;P

-- 
Thomas Wouters <thomas@xs4all.net>

Hi! I'm a .signature virus! copy me into your .signature file to help me spread!