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/2009-March/087228.html below:

[Python-Dev] PEP 377 - allow __enter__() methods to skip the statement body

[Python-Dev] PEP 377 - allow __enter__() methods to skip the statement body [Python-Dev] PEP 377 - allow __enter__() methods to skip the statement body"Martin v. Löwis" martin at v.loewis.de
Sun Mar 15 20:38:57 CET 2009
> Note that using exceptions for control flow can  be bad for other
> implementations of Python. For example exceptions on the .NET framework
> are very expensive.

Why do you say that? What specific implementation of .NET are you
referring to? What do you mean by "very"?

> Isn't it better practise for exceptions to be used for exceptional
> circumstances rather than for control flow?

This is an ongoing debate (in Python, and outside). I'm in the camp
that says that exceptions are a control flow mechanism just like
loops, conditionals, and recursion. With exceptions, you get essentially
multiple alternative outcomes of a function call, rather than just a
single result. In principle, it would be possible to eliminate the
return statement altogether, but it is useful syntactic sugar.

Regards,
Martin
More information about the Python-Dev mailing list

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