#36342: Slicing a QuerySet with a result cache results in a list?
-------------------------------------+-------------------------------------
     Reporter:  Willem Van Onsem     |                    Owner:  (none)
         Type:                       |                   Status:  closed
  Cleanup/optimization               |
    Component:  Database layer       |                  Version:  5.2
  (models, ORM)                      |
     Severity:  Normal               |               Resolution:  invalid
     Keywords:                       |             Triage Stage:
                                     |  Unreviewed
    Has patch:  0                    |      Needs documentation:  0
  Needs tests:  0                    |  Patch needs improvement:  0
Easy pickings:  0                    |                    UI/UX:  0
-------------------------------------+-------------------------------------
Comment (by Willem Van Onsem):

 I think it is indeed not a bug, it is more a feature request, since it
 results in unpredictable behavior, since you don't know per se if the
 queryset got evaluated. It is more whether we can not, when slicing an
 evaluated queryset, return a queryset with cached results. Then the
 outcome is not different depending on the *state* of the `QuerySet`.

 Slicing with a step is more predictable, since it will *always* return a
 list when sliced, whereas the slicing without a step, thus depends on the
 state of the `QuerySet` which is harder to determine.
-- 
Ticket URL: <https://code.djangoproject.com/ticket/36342#comment:2>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.

-- 
You received this message because you are subscribed to the Google Groups 
"Django updates" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion visit 
https://groups.google.com/d/msgid/django-updates/010701965f124c34-c4d2583d-62ca-4104-89eb-8ab69b1f6362-000000%40eu-central-1.amazonses.com.

Reply via email to