[prev in list] [next in list] [prev in thread] [next in thread]
List: python-dev
Subject: Re: [Python-Dev] PEP 310 and exceptions
From: "Phillip J. Eby" <pje () telecommunity ! com>
Date: 2005-04-23 17:50:14
Message-ID: 5.1.1.6.0.20050423134807.03ab79d0 () mail ! telecommunity ! com
[Download RAW message or body]
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.
_______________________________________________
Python-Dev mailing list
Python-Dev@python.org
http://mail.python.org/mailman/listinfo/python-dev
Unsubscribe: http://mail.python.org/mailman/options/python-dev/python-dev%40progressive-comp.com
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic