deprecation of has_key?

Steve Holden steve at holdenweb.com
Thu Apr 21 07:29:14 EDT 2005


Luis Bruno wrote:
> Hello,
> 
> Steve Holden wrote:
> 
>>Two words: backward compatibility. To lose that method now would break 
>>thousands of existing programs. The 2.4 library would probably 
>>experience breakage too ... let's see:
>>
>>$ find /lib/python2.4/ -name "*.py" -exec grep has_key {} \; | wc -l
>>587
> 
> 
> Is there any interest in changing that to the "key in dict" sintax?
> 

The general principles on which maintenance is based for Python decree 
that such changes not be made gratuitously: the code as it is works now, 
so it is only worth changing when has_key is removed.

If a module were being edited for other reasons there would be no 
objection to removal of the has_key usage then, but the chance of 
breakage due to careless modification is high enough to want to avoid it 
unless really *necessary*.

regards
  Steve
-- 
Steve Holden        +1 703 861 4237  +1 800 494 3119
Holden Web LLC             http://www.holdenweb.com/
Python Web Programming  http://pydish.holdenweb.com/



More information about the Python-list mailing list