[Python-3000] Fwd: Re: Fwd: Re: Fwd: Re: Octal

Patrick Maupin pmaupin at gmail.com
Thu Mar 15 05:25:10 CET 2007


On 3/14/07, Greg Ewing <greg.ewing at canterbury.ac.nz> wrote:
> Raymond Hettinger wrote:
>
> > The worst part of the new user experience is encountering a
> > SyntaxError.  Because of the way we generate them, invalid
> > syntax errors are not very informative
>
> This seems like an argument for producing more informative
> error messages. Something like
>
>    Syntax error: Numeric literal with leading zeroes is
>    ambiguous. Use 0t123 for an octal literal, or omit the
>    leading zeroes for a decimal literal.
>
> should make it pretty clear what the problem is and
> how to fix it.

What, you don't like:

>>> 09
  File "<stdin>", line 1
    09
     ^
SyntaxError: invalid token

I can't imagine why :)

Raymond makes a very good point that syntax errors are the bane of
newbies.  When I started using Python, I was very impressed with the
accuracy and utility of the exception system.  It may be that most
experienced programmers have similar feelings, so it would seem that
nobody has turned a critical eye on the reporting of errors to nervous
first-time programmers who are already worried they are going to break
the machine.


More information about the Python-3000 mailing list