deprecation of has_key?
Steven Bethard
steven.bethard at gmail.com
Thu Apr 21 12:54:54 EDT 2005
Fredrik Lundh wrote:
> 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...
True enough. Grepping through my (small) code base, I found only five
uses of "key in dict" style code...
STeVe
More information about the Python-list
mailing list