Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #88770
| From | dieter <dieter@handshake.de> |
|---|---|
| Subject | Re: Exception Handling |
| Date | 2015-04-10 08:11 +0200 |
| References | <b6461fc8-a18b-4d61-86f9-65370b0a149d@googlegroups.com> |
| Newsgroups | comp.lang.python |
| Message-ID | <mailman.195.1428646323.12925.python-list@python.org> (permalink) |
Palpandi <palpandi111@gmail.com> writes: > Is there any way to roll back or undo changes which are all done before exception occurs. You are mostly interested in such a function when you handle persistent data (data which persists across program activations - otherwise, you can always quit the current program and restart it again). Python usually does not handle persistent data by itself but uses some kind of library or external system - e.g. a relational database. Those external components may support the concept of "transaction". Their primary function is to ensure a consistent persistant state in view of concurrent modifications. As a side effect, they support a "rollback" which rolls back all modifications to persistent data made by the rolled back transaction. With some limitations, you can use the Python modules "ZODB3" and "transaction" (available on "PyPI") to use transactions in your program - even if you are not interested in persistent data. Its "rollback" will not undo all changes but only changes to "ZODB object"s.
Back to comp.lang.python | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
Exception Handling Palpandi <palpandi111@gmail.com> - 2015-04-09 02:31 -0700
Re: Exception Handling Chris Angelico <rosuav@gmail.com> - 2015-04-09 20:36 +1000
Re: Exception Handling Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2015-04-10 01:05 +1000
Re: Exception Handling dieter <dieter@handshake.de> - 2015-04-10 08:11 +0200
Re: Exception Handling Palpandi <palpandi111@gmail.com> - 2015-04-10 01:39 -0700
Re: Exception Handling Chris Angelico <rosuav@gmail.com> - 2015-04-10 19:00 +1000
Re: Exception Handling dieter <dieter@handshake.de> - 2015-04-11 07:39 +0200
csiph-web