Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #75919 > unrolled thread
| Started by | Chris Angelico <rosuav@gmail.com> |
|---|---|
| First post | 2014-08-09 10:39 +1000 |
| Last post | 2014-08-09 10:39 +1000 |
| Articles | 1 — 1 participant |
Back to article view | Back to comp.lang.python
This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by
below is the oldest one visible, not the original post.
Re: Newbie needing some help Chris Angelico <rosuav@gmail.com> - 2014-08-09 10:39 +1000
| From | Chris Angelico <rosuav@gmail.com> |
|---|---|
| Date | 2014-08-09 10:39 +1000 |
| Subject | Re: Newbie needing some help |
| Message-ID | <mailman.12774.1407544763.18130.python-list@python.org> |
On Sat, Aug 9, 2014 at 10:32 AM, Chris Kaynor <ckaynor@zindagigames.com> wrote: > The main issue I can see with that idea is that the exception will keep a > reference to the database connection (as with all locals), so unless you > explicitly close it within a finally clause, the database connection could > still be left hanging, and thus no rollback will occur. To clarify: The simple example I used there was assumed to be the entire program, meaning that the process will terminate on exception. No worries about resource release then! This kind of model works nicely for anything that reads from one source and writes into the database, or processes data from the database back into the database, or anything like that. The general assumption is that an unexpected exception should be treated as fatal - just write to the console and terminate. While this might seem like the simplest 1% of cases, it's able to handle a lot of real-world situations. And since it takes no extra code, it's the perfect way to start :) ChrisA
Back to top | Article view | comp.lang.python
csiph-web