"xxx.has_key(a)" vs "a in xxx"

Terry Reedy tjreedy at udel.edu
Thu Oct 30 10:47:55 EDT 2008


Łukasz Ligowski wrote:
> Hi, 
> 
> There is small inconsistency (or I don't understand it right) between python 
> 2.5 docs and python 2.6 docs.
> 
> 2.5 docs say that:
>  "a.has_key(k) Equivalent to k in a, use that form in new code"
> 
> 2.6 docs say that:
>  "dict.has_key(key) is equivalent to key in d, but deprecated."
> 
> which is true?

Both. Dict.has_key is gone in 3.0.




More information about the Python-list mailing list