[Python-Dev] SyntaxError for illegal literals

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


On Tue, 13 Feb 2001, Guido van Rossum wrote:
> All good points, except that I still find it hard to flag overflow
> errors as syntax errors, especially since overflow is platform
> defined.

I know it may seem weird.  I tend to see it as a consequence of
the language definition, though, not as the wrong choice of error.
If you had to write a truly platform-independent Python language
definition (a worthwhile endeavour, by the way, especially given
that there are already at least CPython, JPython, and stackless),
the decision about this would have to be made there.

> On one platform, 1000000000000 is fine; on another it's a
> SyntaxError.  That could be confusing.

So far, Python is effectively defined in such a way that
100000000000 has a meaning on one platform and has no meaning
on another.  <shrug>  So, yeah, that's the way it is.

> Another solution (borrowing from C): automatically promote int
> literals to long if they can't be evaluated as ints.

Quite reasonable, yes.  But i'd go further than that.  I think
everyone so far has been in agreement that the division between
ints and long ints should eventually be abolished, and we're
just waiting for someone brave enough to come along and make it
happen.  I know i've got my fingers crossed. :)

(And maybe after we deprecate 'L', we can deprecate capital 'J'
on numbers and 'R', 'U' on strings too...)

toowtdi-ly yours,


-- ?!ng