Slight irritation with try/finally indentation
Aahz
aahz at pythoncraft.com
Sat May 4 12:52:33 EDT 2002
In article <mailman.1020525489.5008.python-list at python.org>,
=?iso-8859-1?q?Fran=E7ois?= Pinard <pinard at iro.umontreal.ca> wrote:
>[Bengt Richter]
>>
>> what about the bigger picture? E.g.,:
>>
>> try:
>> acquire_resources()
>> try:
>> process()
>> finally:
>> release_resources()
>> except AcquireResourceFailure:
>> handle_resource_acquisition_failure()
>> except ProcessFailure:
>> handle_process_failure()
>> else:
>> wrap_up_clean_process_completion()
>
>I see your idea, Bengt, but I fear it would not be practical in my case.
>As I use such constructs a bit all over the place and very often in the
>application I am working on, bloating every occurrence would be unfortunate
>for the overall aspect of the program.
>
>Your suggestion would be very welcome if used only a few times, near the
>outer extent of the overall organisation of a big program.
I think Bengt would suggest (and I *know* Alex would suggest) that you
wrap all this up in a function where you pass in function pointers.
--
Aahz (aahz at pythoncraft.com) <*> http://www.pythoncraft.com/
"I used to have a .sig but I found it impossible to please everyone..." --SFJ
More information about the Python-list
mailing list