Consider these two snippets:
try:
a+a=a
except SyntaxError:
print "first exception caught"
.
try:
eval("a+a=a")
except SyntaxError:
print "second exception caught"
In the second case the "second exception .." statement is printed (exception caught), while in the first one isn't.
Is first exception (lets call it "SyntaxError1") any different from second one ("SyntaxError2")?
Is there any way to catch SyntaxError1 (thus supressing compilation-time errors)? Wrapping large blocks of code in eval
is unsatisfactory ;)