Slight irritation with try/finally indentation

François Pinard pinard at iro.umontreal.ca
Sat May 4 11:17:13 EDT 2002


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

-- 
François Pinard   http://www.iro.umontreal.ca/~pinard






More information about the Python-list mailing list