[Python-Dev] SyntaxError for illegal literals

Tim Peters tim.one@home.com
Thu, 15 Feb 2001 04:07:38 -0500


[Ka-Ping Yee]
> ...
> The only exceptions that don't currently conform, as far as i
> know, have to do with invalid literals.

Pretty much, but nothing's *that* easy.

Other examples:

+ If there are too many nested blocks, it raises SystemError(!).

+ MemoryError is raised if a dotted name is too long.

+ OverflowError is raised if a string is too long.

Note that those don't have to do with syntax, they're arbitrary
implementation limits.  So that's the rule:  raise

    SystemError if something is bigger than 20
    MemoryError if it's bigger than 1000
    OverflowError if it's bigger than an int

Couldn't be clearer <wink>.

+ SystemErrors are raised in many other places in the role of internal
assertions failing.  Those needn't be changed.