deprecation of has_key?

Fredrik Lundh fredrik at pythonware.com
Thu Apr 21 11:27:59 EDT 2005


Steven Bethard wrote:

>> For me dictionary is a collection of key-value pairs, but not a
>> collection of keys (that's what set is).
> 
> Ahh, ok.  Now I understand.  I think you could probably search the 
> python-dev archives and see why the decision was made as it was.  For 
> pretty much all my purposes, "key in dict" is much more useful than 
> "item in dict".  Practicality beats Purity and all. ;)

well, for all my purposes, I find that "dict.get(key)" (or sometimes "dict[key]"
is a lot more useful than has_key and in...

</F>




More information about the Python-list mailing list