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

Roy Smith roy at panix.com
Sun Jul 10 10:00:15 EDT 2005


aahz at 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.



More information about the Python-list mailing list