[Tutor] Performance difference, ``in'' vs ``has_key()''

Max Noel maxnoel_fr at yahoo.fr
Mon Jul 18 00:53:49 CEST 2005

On Jul 17, 2005, at 20:18, Bill Campbell wrote:

> Is there any significant performance difference between the
> tests, ``key in dictionary'' and ``dictionary.has_key(key)''?
> I would prefer using the ``key in'' because it's a bit easier to
> type, and can also be used with lists in addition to dictionaries.

     While we're on that topic, is there a particular reason why  
'in', in a dict context, searches the keys instead of doing the  
logical thing and searching the values?

-- Max
maxnoel_fr at yahoo dot fr -- ICQ #85274019
"Look at you hacker... A pathetic creature of meat and bone, panting  
and sweating as you run through my corridors... How can you challenge  
a perfect, immortal machine?"


Appel audio GRATUIT partout dans le monde avec le nouveau Yahoo! Messenger 
Téléchargez cette version sur http://fr.messenger.yahoo.com

More information about the Tutor mailing list