always raise syntax error!
claird at lairds.us
Tue Oct 17 01:00:14 CEST 2006
In article <rOKdnUboBcQgNLLYnZ2dnUVZ_vCdnZ2d at comcast.com>,
Larry Bates <larry.bates at websafe.com> wrote:
>> well, I would say, the reason why I could not position the error code
>> may partly due to the ambiguous message that python provides. the lines
>> that python pointed to contains no error, I think the error codes must
>> be too far away from there. anyway, I hope python would make more
>> detailed error messages, like c++ compilers do. such as: "missing ;" or
>> "(" not matching...etc.
>Occassionally I will have phantom syntax errors that seem to be
>attributable to non-printing characters in a line. Other times the
>error is in fact far above the place pointed to by the syntax error.
>Start by commenting out large chunks of code with triple quotes and
>slowly work towards the lines with a problem.
I'll reinforce part of this: if C++ compilers are our standard,
Python needn't feel shame about its error-reporting. While I've
long advocated upgrades to Python's diagnostic-reporting, it's
simply not true that Python points to "no error". Python reports
a syntax error on a particular line only when there's sufficient
I recognize a background with C++ will probably necessitate
accomodation to Python, because the two do NOT employ the same
style for syntax questions. Please, though, daniel: don't make
the mistake of thinking Python's syntax is a mystery.
More information about the Python-list