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-April/052869.html below:

[Python-Dev] PEP 310 and exceptions

[Python-Dev] PEP 310 and exceptions [Python-Dev] PEP 310 and exceptionsPhillip J. Eby pje at telecommunity.com
Sat Apr 23 19:50:14 CEST 2005
At 01:41 PM 4/23/05 +1000, Nick Coghlan wrote:
>Whichever way that point goes, this definition would allow PEP 310 to 
>handle Alex's example of factoring out standardised exception handling, as 
>well as the original use case of resource cleanup, and the transaction 
>handling:
>
>class transaction(object):
>     def __enter__(self):
>         begin_transaction()
>
>     def __except__(self, *exc_info):
>         abort_transaction()
>
>     def __else__(self):
>         commit_transaction()

I'd like to suggest '__success__' in place of '__else__' and 
'__before__'/'__after__' instead of '__enter__'/'__exit__', if you do take 
this approach, so that what they do is a bit more obvious. 

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