dict.has_key(x) versus 'x in dict'

Bjoern Schliessmann usenet-mail-0306.20.chr0n0ss at spamgourmet.com
Wed Dec 6 11:16:46 EST 2006


Peter Otten wrote:

> No, 'k in d' is equivalent to 'd.has_key(k)', only with less
> (constant) overhead for the function call. 

Ah, thx. Thought the "x in d" syntax might search in d.values() too.

Regards,


Björn

-- 
BOFH excuse #12:

dry joints on cable plug




More information about the Python-list mailing list