Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #88770

Re: Exception Handling

Return-Path <python-python-list@m.gmane.org>
X-Original-To python-list@python.org
Delivered-To python-list@mail.python.org
X-Spam-Status OK 0.016
X-Spam-Evidence '*H*': 0.97; '*S*': 0.00; 'received:80.91': 0.09; 'received:80.91.229': 0.09; 'received:gmane.org': 0.09; 'received:list': 0.09; 'restart': 0.09; 'python': 0.11; 'mostly': 0.14; 'changes': 0.15; '(data': 0.16; 'concurrent': 0.16; 'effect,': 0.16; 'occurs.': 0.16; 'received:80.91.229.3': 0.16; 'received:dip0.t-ipconnect.de': 0.16; 'received:plane.gmane.org': 0.16; 'received:t-ipconnect.de': 0.16; 'undo': 0.16; 'exception': 0.16; 'library': 0.18; 'otherwise,': 0.22; 'header:User-Agent:1': 0.23; 'primary': 0.26; 'header:X-Complaints-To:1': 0.27; 'function': 0.29; 'external': 0.29; 'usually': 0.31; 'relational': 0.31; 'writes:': 0.31; 'but': 0.35; 'there': 0.35; 'consistent': 0.36; 'done': 0.36; 'charset:us-ascii': 0.36; 'e.g.': 0.38; 'handle': 0.38; 'to:addr:python-list': 0.38; 'does': 0.39; 'itself': 0.39; 'to:addr:python.org': 0.39; 'received:org': 0.40; 'ensure': 0.60; 'even': 0.60; 'transaction.': 0.60; 'back': 0.62; 'received:217': 0.63; 'kind': 0.63; 'such': 0.63; 'side': 0.67; 'limitations,': 0.84; 'persistent': 0.84; 'rolls': 0.84; 'transactions': 0.91
X-Injected-Via-Gmane http://gmane.org/
To python-list@python.org
From dieter <dieter@handshake.de>
Subject Re: Exception Handling
Date Fri, 10 Apr 2015 08:11:51 +0200
References <b6461fc8-a18b-4d61-86f9-65370b0a149d@googlegroups.com>
Mime-Version 1.0
Content-Type text/plain; charset=us-ascii
X-Gmane-NNTP-Posting-Host pd9e08d05.dip0.t-ipconnect.de
User-Agent Gnus/5.1008 (Gnus v5.10.8) XEmacs/21.4.22 (linux)
Cancel-Lock sha1:pnh0w7UOpiQMoUqdu5Lg+AyeF8A=
X-BeenThere python-list@python.org
X-Mailman-Version 2.1.20
Precedence list
List-Id General discussion list for the Python programming language <python-list.python.org>
List-Unsubscribe <https://mail.python.org/mailman/options/python-list>, <mailto:python-list-request@python.org?subject=unsubscribe>
List-Archive <http://mail.python.org/pipermail/python-list/>
List-Post <mailto:python-list@python.org>
List-Help <mailto:python-list-request@python.org?subject=help>
List-Subscribe <https://mail.python.org/mailman/listinfo/python-list>, <mailto:python-list-request@python.org?subject=subscribe>
Newsgroups comp.lang.python
Message-ID <mailman.195.1428646323.12925.python-list@python.org> (permalink)
Lines 23
NNTP-Posting-Host 2001:888:2000:d::a6
X-Trace 1428646323 news.xs4all.nl 2870 [2001:888:2000:d::a6]:47700
X-Complaints-To abuse@xs4all.nl
Path csiph.com!usenet.pasdenom.info!bete-des-vosges.org!feed.ac-versailles.fr!nerim.net!novso.com!newsfeed.xs4all.nl!newsfeed2a.news.xs4all.nl!xs4all!newsgate.cistron.nl!newsgate.news.xs4all.nl!post.news.xs4all.nl!not-for-mail
Xref csiph.com comp.lang.python:88770

Show key headers only | View raw


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 | NextPrevious in thread | Next in thread | Find similar | Unroll thread


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