Changes between Version 1 and Version 2 of Ticket #35154


Ignore:
Timestamp:
Jan 30, 2024, 6:19:35 AM (4 months ago)
Author:
Tim Graham
Comment:

Legend:

Unmodified
Added
Removed
Modified
  • Ticket #35154 – Description

    v1 v2  
    1 This is a similar proposal to https://code.djangoproject.com/ticket/31561, but it is not the same. Currently using
    2 {{{
    3 x in myQuerySet
    4 }}}
    5 results in python using the fallback solution: https://docs.python.org/3/reference/expressions.html#membership-test-details
    6 Because https://groups.google.com/g/django-developers/c/NZaMq9BALrs/m/OCNTh6QyCAAJ deiced to implement contains in https://code.djangoproject.com/ticket/24141
    7 I think it is only consistent to have the same behavior implemented in `__contains__`. I would expect that, it is also a more efficient implementation and unifies django behavior. Nevertheless, documentation is needed why this inconsistency exists. I was not able to find a reason. Because the mailing list agreed on adding contains, this is discussed behavior. Why was `__contains__` not added in the first place? To not have breaking changes? I cannot see what would break.
     1This is a similar proposal to #31561, but it is not the same. Currently using `x in myQuerySet` results in Python using the fallback solution: https://docs.python.org/3/reference/expressions.html#membership-test-details because https://groups.google.com/g/django-developers/c/NZaMq9BALrs/m/OCNTh6QyCAAJ decided to implement contains in #24141.
    82
    9 As said in https://code.djangoproject.com/ticket/31561 a queryset could be a collection to make typing easier. But this is not the intention of this issue.
     3I think it is only consistent to have the same behavior implemented in `__contains__`. I would expect that, it is also a more efficient implementation and unifies Django behavior. Nevertheless, documentation is needed why this inconsistency exists. I was not able to find a reason. Because the mailing list agreed on adding contains, this is discussed behavior. Why was `__contains__` not added in the first place? To not have breaking changes? I cannot see what would break.
    104
     5As said in #31561 a queryset could be a collection to make typing easier. But this is not the intention of this issue.
Back to Top