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.
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