Timeline for answer to Making sure that all exceptions are caught in Python by Constantinius
Current License: CC BY-SA 3.0
Post Revisions
6 events
| when toggle format | what | by | license | comment | |
|---|---|---|---|---|---|
| Mar 12, 2015 at 13:45 | comment | added | DavidRR |
@JAB: Note that "as e" syntax is also available in 2.7.9 (and possibly prior versions of 2.x). From the 2.7.9 tutorial, see 8.3. Handling Exceptions.
|
|
| Jul 25, 2011 at 15:03 | comment | added | Wilduck | I don't think the OP is asking how to catch exceptions (the interpreter will tell you when your code breaks) but instead how to insure that code is correct. | |
| Jul 25, 2011 at 14:39 | comment | added | user395760 |
But it does catch genuine bugs like variable/member name typos (NameError, AttributeError) though, and (if swallowing the exceptions, what OP seems to intend) prevents code higher up the call chain from actually handling (as opposed to ignoring) the error.
|
|
| Jul 25, 2011 at 14:31 | comment | added | Jochen Ritzel |
except doesnt catch SyntaxErrors
|
|
| Jul 25, 2011 at 14:10 | comment | added | JAB | Note that in Python 3 it's "as e", not ", e". | |
| Jul 25, 2011 at 14:05 | history | answered | Constantinius | CC BY-SA 3.0 |