[Python-Dev] SyntaxError for illegal literals

Ka-Ping Yee ping@lfw.org
Wed, 14 Feb 2001 03:36:54 -0800 (PST)


On Wed, 14 Feb 2001, Greg Ewing wrote:
> How about introducing the following hierarchy:
> 
>   CompileTimeError
>     SyntaxError
>     LiteralRangeError
> 
> LiteralRangeError could inherit from ValueError as well
> if you want.

I suppose that's all right, and i wouldn't complain, but i don't
think it's all that necessary either.  Compile-time errors *are*
syntax errors.  What else could they be?  (Aside from fatal
errors or limitations of the compiler implementation, that is,
but again that's outside of the abstraction we're presenting to
the Python user.)

Think of it this way: if there's a problem with your Python program,
it's either a problem with *how* it expresses something (syntax), or
with *what* it expresses (semantics).  The syntactic errors occur
at compile-time and the semantic errors occur at run-time.


-- ?!ng