We have django.utils.deprecation.RenameMethodsBase to help with that, but 
now I see that subclasses have this signature, `def has_key(self, key, 
version=None)`, so it doesn't seem the method can be replaced with 
__contains__.

Proposal withdrawn.

On Sunday, January 31, 2016 at 4:26:12 AM UTC-5, Adam Johnson wrote:
>
> Might be problematic for third-party cache backends which implement 
> *has_key* and rely on *__contains__* calling it - don't see how you can 
> show the warning in that case.
>
> On Saturday, January 30, 2016 at 12:34:14 PM UTC, Tim Graham wrote:
>>
>> Yes, but dict.has_key() is removed in Python 3. If we started the 
>> deprecation in Django now, it would be scheduled for removal in Django 2.0 
>> which also drops support for Python 2.
>>
>> On Friday, January 29, 2016 at 8:04:33 PM UTC-5, Curtis Maloney wrote:
>>>
>>> Isn't this so it complies with the dict interface? True, it's 
>>> discouraged now, but it's still there.
>>>
>>>
>>>
>>> On 30 January 2016 10:42:12 am LHDT, Tim Graham <timog...@gmail.com> 
>>> wrote:
>>>>
>>>> Also the template BaseContext class has an undocumented has_key() 
>>>> method. I wonder if that can be removed without a deprecation?
>>>>
>>>> https://github.com/django/django/pull/6066
>>>>
>>>> On Friday, January 29, 2016 at 6:11:54 PM UTC-5, Tim Graham wrote:
>>>>>
>>>>> Any opposition to deprecating Cache.has_key()? Cache already 
>>>>> implements __contains__() so converting has_key() to "in" can be done 
>>>>> with 
>>>>> existing versions of Django. Anyone using flake8 will get a warning about 
>>>>> has_key() usage: W601 .has_key() is deprecated, use 'in'.
>>>>>
>>>>
>>> -- 
>>> Sent from my Android device with K-9 Mail. Please excuse my brevity.
>>>
>>

-- 
You received this message because you are subscribed to the Google Groups 
"Django developers  (Contributions to Django itself)" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-developers+unsubscr...@googlegroups.com.
To post to this group, send email to django-developers@googlegroups.com.
Visit this group at https://groups.google.com/group/django-developers.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-developers/97220f93-8aaa-4183-bb52-b72fe1b2d787%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to