[Python-Dev] Fwd: try...else

Moshe Zadka moshez@zadka.site.co.il
28 Dec 2000 16:28:07 -0000


On Thu, 28 Dec 2000, "M.-A. Lemburg" <mal@lemburg.com> wrote:

> He does have a point however that 'return' will bypass 
> try...else and try...finally clauses. I don't think we can change
> that behaviour, though, as it would break code.

It doesn't bypass try..finally:

>>> def foo():
...     try:
...             print "hello"
...             return
...     finally:
...             print "goodbye"
...
>>> foo()
hello
goodbye