Timeline for answer to Correct way of handling exceptions in Python? by Jacob B
Current License: CC BY-SA 2.5
Post Revisions
4 events
| when toggle format | what | by | license | comment | |
|---|---|---|---|---|---|
| Jun 12, 2009 at 1:24 | comment | added | Jacob B | But you can always build your own wrappers--they're lightweight enough, especially if you use decorators, and worth it if they can make your code more readable. | |
| Jun 12, 2009 at 1:10 | comment | added | Tom | sadly i cant rely on enter and exit methods to be defined for all operations i will use, so with might always not work | |
| Jun 12, 2009 at 1:00 | comment | added | Tom | because one big try block wont give you the chance to take care of ressources. E.g.: statement1 worked, and opened a file, but statement 2 throws an exception. You cant handle that in one single finally block, because you never know if the resource was actually allocated or not. Also, some steps can fire the same Exceptions, so it cant be determined what went wrong later on, and you cant print errors, because youre not sure which statement actually failed. | |
| Jun 12, 2009 at 0:57 | history | answered | Jacob B | CC BY-SA 2.5 |