False, inline syntax errors show up every time:
[EMAIL PROTECTED]:~$ cat <<DOC|python
> try:
> there's got to be a f'kin syntax error here somewhere :-)
> except:
> pass
> DOC
File "<stdin>", line 2
there's got to be a f'kin syntax error here somewhere :-)
^
SyntaxError: invalid syntax
[EMAIL PROTECTED]:~$
I think you can only catch syntax errors in eval'd code and code parsed
using the import statement:
[EMAIL PROTECTED]:~$ cat <<DOC|python
> try:
> eval("there's got to be a f'kin syntax error here somewhere :-)")
> print "We totally got away with that dude"
> except:
> print "Boned!"
> DOC
Boned!
[EMAIL PROTECTED]:~$
** NOTE: ** I piped this in with bash to illustrate that the interactive
interpreter wasn't being clever.
Your point still stands though :-) If you *ever* type "except:",
immediately stop and consider whether you really meant to do that or
not. There are legitimate reasons for catching all exceptions - I catch
all exceptions in my preforked socket-server abstraction, but only to
print them and carry on with the next job - but not a lot.
-Rob
Max Ischenko wrote:
>
> Do not use catch-all try/except block (you may have SyntaxError inside
> byName() method you''ll never see)
>
>
> >
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"TurboGears" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at http://groups.google.com/group/turbogears
-~----------~----~----~----~------~----~------~--~---