What is "finally:" for?

Andreas Kaiser kaiser.vocote at gmail.com
Tue Sep 16 07:47:51 EDT 2008


On 16 Sep., 13:25, "Max Ivanov" <ivanov.ma... at gmail.com> wrote:
> Hi all!
> When and where I should use try-except-finally statement? What is the
> difference between:
> --------
> try:
>   A...
> except:
>   B....
> finally:
>   C...
> --------
>
> and
> -------
> try:
>   A...
> except:
>   B....
> C...

Look at: http://docs.python.org/ref/try.html and http://bytes.com/forum/thread24648.html

The python doc says:
"Changed in version 2.5: In previous versions of Python,
try...except...finally did not work. try...except had to be nested in
try...finally."

Andreas



More information about the Python-list mailing list