A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://mail.python.org/pipermail/python-dev/2005-August/055624.html below:

[Python-Dev] Bare except clauses in PEP 348

[Python-Dev] Bare except clauses in PEP 348 [Python-Dev] Bare except clauses in PEP 348Niko Matsakis niko at alum.mit.edu
Wed Aug 24 18:29:36 CEST 2005
>
> txn = new_transaction()
> try:
>      txn.begin()
>      rtn = do_work()
> finally:
>      if exception_occurred():
>          txn.abort()
>      else:
>          txn.commit()
>          return rtn
>

Couldn't you just do:

txn = new_transaction ()
try:
     complete = 0
     txn.begin ()
     rtn = do_work ()
     complete = 1
finally:
     if not complete: txn.abort ()
     else: txn.commit ()

and then not need new builtins or anything fancy?


Niko

More information about the Python-Dev mailing list

RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4