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/2014-February/132661.html below:

[Python-Dev] PEP 463: Exception-catching expressions

[Python-Dev] PEP 463: Exception-catching expressions [Python-Dev] PEP 463: Exception-catching expressionsAntoine Pitrou solipsis at pitrou.net
Sat Feb 22 10:20:51 CET 2014
On Sat, 22 Feb 2014 16:12:27 +0900
"Stephen J. Turnbull" <stephen at xemacs.org> wrote:
> 
> Note in support: I originally thought that "get" methods would be more
> efficient, but since Nick pointed out that "haveattr" is implemented
> by catching the exception (Yikes! LBYL implemented by using EAFP!), I
> assume that get methods also are (explicitly or implicitly)
> implemented that way.

Well, the only way to know that a key (or attribute) exists is to do
the lookup. What else would you suggest?

And, yes, EAFP can avoid race conditions and the like (besides being
more efficient with non-trivial keys).

Regards

Antoine.


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