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/2012-March/117776.html below:

[Python-Dev] [Python-checkins] cpython (2.7): Closes #14306: clarify expensiveness of try-except and update code snippet

[Python-Dev] [Python-checkins] cpython (2.7): Closes #14306: clarify expensiveness of try-except and update code snippetNick Coghlan ncoghlan at gmail.com
Sun Mar 18 14:49:25 CET 2012
On Sun, Mar 18, 2012 at 1:58 AM, georg.brandl
<python-checkins at python.org> wrote:
> +catching an exception is expensive.  In versions of Python prior to 2.0 it was
> +common to use this idiom::

Actually, given the "prior to 2.0" caveat, "mydict.has_key(key)" is
right: the "key in mydict" version was only added in 2.2.

This answer probably needs more improvements than just modernising the
example that is already there.

Cheers,
Nick.

-- 
Nick Coghlan   |   ncoghlan at gmail.com   |   Brisbane, Australia
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