Possible Duplicate:
'has_key()' or 'in'?
In Python, there're two ways of deciding whether a key is in a dict:
if dict.has_key(key) and if key in dict
Someone tells me that the second one is slower than the first one since the in keyword makes the expression an iteration over the dict, so it will be slower than the has_key alternative, which apparently uses hash to make the decision.
As I highly doubt the difference, since I think Python is smart enough to translate an in keyword before a dict to some hash way, I can't find any formal claim about this.
So is there really any efficiency difference between the two?
Thanks.