A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://mail.python.org/pipermail/python-dev/2000-December/011222.html below:

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

[Python-Dev] Fwd: try...elseMichael Hudson mwh21@cam.ac.uk
Thu, 28 Dec 2000 18:27:48 +0000 (GMT)
On Thu, 28 Dec 2000, M.-A. Lemburg wrote:

> I think Robin mixed up try...finally with try...except...else.

I think so too.

> The finally clause is executed even in case an exception occurred.
> 
> 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.

return does not skip finally clauses[1].  In my not especially humble
opinion, the current behaviour is the Right Thing.  I'd have to think for
a moment before saying what Robin's example would print, but I think the
alternative would disturb me far more.

Cheers,
M.

[1] In fact the flow of control on return is very similar to that of an
    exception - ooh, look at that implementation...




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