HOWTO : Py_CompileString !?!?!

Jp Calderone exarkun at intarweb.us
Fri Jan 31 11:16:36 EST 2003


On Fri, Jan 31, 2003 at 10:46:51AM -0500, Luc wrote:
> [snip]
> >
> >There isn't a syntax error I can see. Until you run the string, python 
> >doesn't know that FOMath hasn't had a function called PointdddValue added 
> >to it. 
> 
> If I understand correctly, because Python is interpreted anything goes 
> for functions names and variables... until runtime. If such syntax error 
> is present the runtime will catch it. Right ???
> 

  Nope.  There really is *no* SyntaxError.  There will be an AttributeError
at runtime.  Both will prevent the program from running successfully, but
they are different kinds of errors.  SyntaxErrors are found at parse/compile
time, most other errors are only found at runtime.  Then, when the erroneous
function name is looked up, *at runtime*, it won't be found, and the
appropriate exception will be raised.

  Jp

-- 
C/C++/Java/Perl/Python/Smalltalk/PHP/ASP/XML/Linux (User+Admin)
Genetic Algorithms/Genetic Programming/Neural Networks
Networking/Multithreading/Legacy Code Maintenance/OpenGL
See my complete resume at http://intarweb.us:8080/
-- 
 up 46 days, 7:49, 5 users, load average: 0.55, 0.34, 0.16
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 196 bytes
Desc: not available
URL: <http://mail.python.org/pipermail/python-list/attachments/20030131/c55be49f/attachment.sig>


More information about the Python-list mailing list