Re: Should I use "if" or "try" (as a matter of speed)?
Available news archives: comp.lang.tcl - comp.lang.python - comp.security.firewalls - sci.crypt - comp.lang.php - comp.lang.javascript
Google
 
Web news.hping.org


comp.lang.python archive

Re: Should I use "if" or "try" (as a matter of speed)?

From: Roy Smith <roy@panix.com>
Date: Sun Jul 10 2005 - 16:00:15 CEST

aahz@pythoncraft.com (Aahz) wrote:
> Using ``in`` saves a bytecode of method lookup on ``has_key()`` (which is
> the correct spelling).

You are right. My example is somewhat out of date w/r/t newer language
features, and writing hasKey() instead of has_key() was just plain a
mistake. Thanks for the corrections.
Received on Thu Sep 29 16:51:50 2005